Example #1
0
int GvMField::set(const char* s)
{
	//delete contents 
	makeRoom(0);

	// TRACE("Parsing an MField from :%s\n",s);

	if (strcmp(s,"[]") == 0) {
		setDefault(TRUE);
		OnChanged();
  		return(1);
	} 


	// create a parser 
	GvInput in;

    in.setString(s);
	in.version = 2.0;
	in.vrml2 = 1;
	
	// read 
	int ret = this->readValue(&in);

	setDefault(FALSE);
	OnChanged();

	return ret;
}
Example #2
0
void RCPerspectiveCamera::createTypeInformation(Shift::PropertyInformationTyped<RCPerspectiveCamera> *info,
                                                const Shift::PropertyInformationCreateData &data)
  {
  auto childBlock = info->createChildrenBlock(data);

  auto proj = childBlock.overrideChild(&RCCamera::projection);
  proj->setCompute([](RCPerspectiveCamera *c)
    {
    c->projection.computeLock() = Eks::TransformUtilities::perspective(
      c->fieldOfView(),
      c->aspectRatio(),
      c->nearClip(),
      c->farClip());
    });

  auto affectsProj = childBlock.createAffects(&proj, 1);

  auto width = childBlock.overrideChild(&RCCamera::viewportWidth);
  width->setAffects(affectsProj, true);

  auto height = childBlock.overrideChild(&RCCamera::viewportHeight);
  height->setAffects(affectsProj, false);

  auto fov = childBlock.add(&RCPerspectiveCamera::fieldOfView, "fieldOfView");
  fov->setDefault(Eks::degreesToRadians(45.0f));
  fov->setAffects(affectsProj, false);

  auto nC = childBlock.add(&RCPerspectiveCamera::nearClip, "nearClip");
  nC->setDefault(0.1f);
  nC->setAffects(affectsProj, false);

  auto fC = childBlock.add(&RCPerspectiveCamera::farClip, "farClip");
  fC->setDefault(100.0f);
  fC->setAffects(affectsProj, false);
  }
Example #3
0
KEMailSettings::KEMailSettings()
    : p(new KEMailSettingsPrivate())
{
    p->m_sCurrentProfile.clear();

    p->m_pConfig = new KConfig(QStringLiteral("emaildefaults"));

    const QStringList groups = p->m_pConfig->groupList();
    for (QStringList::ConstIterator it = groups.begin(); it != groups.end(); ++it) {
        if ((*it).startsWith(QLatin1String("PROFILE_"))) {
            p->profiles += (*it).mid(8, (*it).length());
        }
    }

    KConfigGroup cg(p->m_pConfig, "Defaults");
    p->m_sDefaultProfile = cg.readEntry("Profile", tr("Default"));
    if (!p->m_sDefaultProfile.isNull()) {
        if (!p->m_pConfig->hasGroup(QStringLiteral("PROFILE_") + p->m_sDefaultProfile)) {
            setDefault(tr("Default"));
        } else {
            setDefault(p->m_sDefaultProfile);
        }
    } else {
        if (!p->profiles.isEmpty()) {
            setDefault(p->profiles[0]);
        } else {
            setDefault(tr("Default"));
        }
    }
    setProfile(defaultProfileName());
}
Example #4
0
void WindowController::updateDefaultButton()
{
	if (mWindow->defaultButton()) {
		// Set new instance
		auto newDefaultButtonController = std::dynamic_pointer_cast<ButtonController>(findResourceById (mWindow->defaultButton().get()));
		if (newDefaultButtonController && (mDefaultId != newDefaultButtonController->getCommandId())) {
			// Deselect previous default button
			if (mDefaultId != -1) {
				auto oldDefaultButtonController = std::dynamic_pointer_cast<ButtonController>(MessageDispatcher::getInstance().getControllerById (mDefaultId));
				if (oldDefaultButtonController) {
					oldDefaultButtonController->setDefault (false);
				}
			}
			// Select new default button
			mDefaultId = newDefaultButtonController->getCommandId();
			newDefaultButtonController->setDefault (true);
			// Redraw window
			::InvalidateRect (mHWnd, NULL, TRUE);
		}
	} else {
		// Clear current instance
		if (mDefaultId != -1) {
			auto oldDefaultButtonController = std::dynamic_pointer_cast<ButtonController>(MessageDispatcher::getInstance().getControllerById (mDefaultId));
			oldDefaultButtonController->setDefault (false);
			mDefaultId = -1;
			// Redraw window
			::InvalidateRect (mHWnd, NULL, TRUE);
		}
	}
}
Example #5
0
File: daemon.cpp Project: spito/dp
void Daemon::processDisconnected( Channel dead ) {
    switch ( _state ) {
    case State::Leaving:
        break;
    case State::Supervising:
        NOTE();
        if ( _rope == dead )
            Logger::log( "working child died" );
        else
            Logger::log( "internal error happened - other connection than rope to the child has died" );
        setDefault();
        break;
    case State::Free:
    case State::Enslaved:
    case State::FormingGroup:
        NOTE();
        Logger::log( "closed connection to " + info( dead ) + " which is weird" );
        setDefault();
        break;
    case State::Running:
    case State::Grouped:
        NOTE();
        Logger::log( "closed connection to " + info( dead ) );
        ::exit( 0 );
    }
}
Example #6
0
void
GpgServerModel::setDefault(const QString &server)
{
	if (server.isEmpty()) {
		setDefault(-1);
	} else {
		const int row = stringList().indexOf(server);
		Q_ASSERT(row >= 0);
		setDefault(row);
	}
}
Example #7
0
void
GpgServerModel::slotRowsRemoved(const QModelIndex &, int start, int end)
{
	if (end < m_defaultRow) {
		// removed before default, i.e. default is moved up
		setDefault(m_defaultRow - (end - start) - 1);
	} else if ((start <= m_defaultRow) && (end >= m_defaultRow)) {
		// the default was deleted
		if (m_defaultRow >= rowCount())
			m_defaultRow = -1; // avoid sending dataChanged() for the already deleted row
		if (rowCount() > 0)
			setDefault(0);
	}
}
    void RimWellPathCompletions::AutomaticWellShutInEnum::setUp()
    {
        addItem(RimWellPathCompletions::ISOLATE_FROM_FORMATION, "SHUT", "Isolate from Formation");
        addItem(RimWellPathCompletions::STOP_ABOVE_FORMATION, "STOP", "Stop above Formation");

        setDefault(RimWellPathCompletions::STOP_ABOVE_FORMATION);
    }
Example #9
0
void Prefs::open() {

    char *p=getenv( "blitzpath" );
    if( !p ) {
        AfxMessageBox( "blitzpath environment variable not found!",MB_TOPMOST|MB_SETFOREGROUND|MB_ICONINFORMATION );
        ExitProcess(0);
    }

    homeDir=p;

    AddFontResource( (homeDir+"/cfg/blitz.fon").c_str() );

    setDefault();

    bool prg_windowed;

    ifstream in( (homeDir+"/cfg/blitzide.prefs").c_str() );
    if( !in.good() ) return;

    while( !in.eof() ) {
        string t;
        in>>t;
        if( !t.size() ) continue;
        while( in.peek()=='\t' ) in.ignore();
        if( t=="prg_debug" ) in>>prg_debug;
        else if( t=="prg_lastbuild" ) getline( in,prg_lastbuild );
        else if( t=="prg_windowed" ) in>>prg_windowed;
        else if( t=="win_maximized" ) in>>win_maximized;
Example #10
0
ApplyChangesWidget::ApplyChangesWidget(QWidget* parent)
    : QDialog(parent), d(new ApplyChangesWidgetPrivate(this))
{
    setSizeGripEnabled(true);

    auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    auto mainLayout = new QVBoxLayout(this);
    auto okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, &QDialogButtonBox::accepted, this, &ApplyChangesWidget::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &ApplyChangesWidget::reject);

    QWidget* w=new QWidget(this);
    d->m_info=new QLabel(w);
    d->m_documentTabs = new QTabWidget(w);
    connect(d->m_documentTabs, &QTabWidget::currentChanged,
            this, &ApplyChangesWidget::indexChanged);

    QVBoxLayout* l = new QVBoxLayout(w);
    l->addWidget(d->m_info);
    l->addWidget(d->m_documentTabs);

    mainLayout->addWidget(w);
    mainLayout->addWidget(buttonBox);

    resize(QSize(800, 400));
}
Example #11
0
 void RimWellPathCompletions::HydrostaticDensityEnum::setUp()
 {
     addItem(RimWellPathCompletions::SEGMENTED, "SEG", "Segmented");
     addItem(RimWellPathCompletions::AVERAGED, "AVG", "Averaged");
     
     setDefault(RimWellPathCompletions::SEGMENTED);
 }
Example #12
0
void AppEnum<RicfExportVisibleCells::ExportKeyword>::setUp()
{
    addItem(RicfExportVisibleCells::FLUXNUM, "FLUXNUM", "FLUXNUM");
    addItem(RicfExportVisibleCells::MULTNUM, "MULTNUM", "MULTNUM");

    setDefault(RicfExportVisibleCells::FLUXNUM);
}
Example #13
0
    void caf::AppEnum< RimDefines::DepthUnitType >::setUp()
    {
        addItem(RimDefines::UNIT_METER,  "UNIT_METER",   "Meter");
        addItem(RimDefines::UNIT_FEET,   "UNIT_FEET",    "Feet");

        setDefault(RimDefines::UNIT_METER);
    }
Example #14
0
void Settings::load(QSettings *settings)
{
    setDefault();

    settings->beginGroup(QLatin1String(Constants::SETTINGS_GROUP));

    scanningScope = static_cast<ScanningScope>(settings->value(QLatin1String(Constants::SCANNING_SCOPE),
        ScanningScopeCurrentFile).toInt());

    KeywordList newKeywords;
    const int keywordsSize = settings->beginReadArray(QLatin1String(Constants::KEYWORDS_LIST));
    if (keywordsSize > 0) {
        const QString nameKey = QLatin1String("name");
        const QString colorKey = QLatin1String("color");
        const QString iconResourceKey = QLatin1String("iconResource"); // Legacy since 3.7 TODO: remove in 4.0
        const QString iconTypeKey = QLatin1String("iconType");
        for (int i = 0; i < keywordsSize; ++i) {
            settings->setArrayIndex(i);
            Keyword keyword;
            keyword.name = settings->value(nameKey).toString();
            keyword.color = settings->value(colorKey).value<QColor>();
            keyword.iconType = settings->contains(iconTypeKey) ?
                        static_cast<IconType>(settings->value(iconTypeKey).toInt())
                      : resourceToTypeKey(settings->value(iconResourceKey).toString());
            newKeywords << keyword;
        }
        keywords = newKeywords;
    }
    settings->endArray();

    settings->endGroup();
}
Example #15
0
void Settings::load(QSettings *settings)
{
    setDefault();

    settings->beginGroup(QLatin1String(Constants::SETTINGS_GROUP));

    scanningScope = static_cast<ScanningScope>(settings->value(QLatin1String(Constants::SCANNING_SCOPE),
        scanningScope).toInt());

    KeywordList newKeywords;
    const int size = settings->beginReadArray(QLatin1String(Constants::KEYWORDS_LIST));
    if (size > 0) {
        const QString nameKey = QLatin1String("name");
        const QString colorKey = QLatin1String("color");
        const QString iconResourceKey = QLatin1String("iconResource");
        for (int i = 0; i < size; ++i) {
            settings->setArrayIndex(i);
            Keyword keyword;
            keyword.name = settings->value(nameKey).toString();
            keyword.color = settings->value(colorKey).value<QColor>();
            keyword.iconResource = settings->value(iconResourceKey).toString();
            newKeywords << keyword;
        }
        keywords = newKeywords;
    }
    settings->endArray();

    settings->endGroup();
}
void caf::AppEnum< RigFemResultPosEnum >::setUp()
{
    addItem(RIG_NODAL,            "NODAL",            "Nodal");
    addItem(RIG_ELEMENT_NODAL,    "ELEMENT_NODAL",    "Element Nodal");
    addItem(RIG_INTEGRATION_POINT,"INTEGRATION_POINT","Integration Point");
    setDefault(RIG_NODAL);
}
Example #17
0
 ParserIntItem::ParserIntItem(const Json::JsonObject& jsonConfig) : ParserItem(jsonConfig)
 {
     if (jsonConfig.has_item("default")) 
         setDefault( jsonConfig.get_int("default") );
     else
         m_default = defaultInt();
 }
Example #18
0
void RimPlotCurve::CurveInterpolation::setUp()
{
    addItem(RiuQwtPlotCurve::INTERPOLATION_POINT_TO_POINT, "INTERPOLATION_POINT_TO_POINT", "Point to Point");
    addItem(RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT,      "INTERPOLATION_STEP_LEFT",      "Step Left");

    setDefault(RiuQwtPlotCurve::INTERPOLATION_POINT_TO_POINT);
}
 ParserDoubleItem::ParserDoubleItem(const Json::JsonObject& jsonConfig) :
         ParserItem(jsonConfig)
 {
     m_default = std::numeric_limits<double>::quiet_NaN();
     if (jsonConfig.has_item("default"))
         setDefault( jsonConfig.get_double("default") );
 }
void AppEnum<DemoPdmObjectA::TestEnumType>::setUp()
{
    addItem(DemoPdmObjectA::T1,           "T1",         "An A letter");
    addItem(DemoPdmObjectA::T2,           "T2",         "A B letter");
    addItem(DemoPdmObjectA::T3,           "T3",         "A B letter");
    setDefault(DemoPdmObjectA::T1);
}
    void AppEnum< MultipleFractures::Action >::setUp()
    {
        addItem(MultipleFractures::APPEND_FRACTURES, "APPEND_FRACTURES", "Append Fractures");
        addItem(MultipleFractures::REPLACE_FRACTURES, "REPLACE_FRACTURES", "Replace Fractures");

        setDefault(MultipleFractures::NONE);
    }
Example #22
0
 void AppEnum<RimLegendConfig::NumberFormatType>::setUp()
 {
     addItem(   RimLegendConfig::AUTO,       "AUTO", "Automatic");
     addItem(   RimLegendConfig::FIXED,      "FIXED",  "Fixed, decimal");
     addItem(   RimLegendConfig::SCIENTIFIC, "SCIENTIFIC",    "Scientific notation");
     setDefault(RimLegendConfig::FIXED);
 }
Example #23
0
 void caf::AppEnum< RimWellPathEntry::WellTypeEnum >::setUp()
 {
     addItem(RimWellPathEntry::WELL_ALL,     "WELL_ALL",     "All");
     addItem(RimWellPathEntry::WELL_SURVEY,  "WELL_SURVEY",  "Survey");
     addItem(RimWellPathEntry::WELL_PLAN,    "WELL_PLAN",    "Plan");
     setDefault(RimWellPathEntry::WELL_ALL);
 }
Example #24
0
    void caf::AppEnum< RimDefines::PorosityModelType >::setUp()
    {
        addItem(RimDefines::MATRIX_MODEL,   "MATRIX_MODEL",     "Matrix");
        addItem(RimDefines::FRACTURE_MODEL, "FRACTURE_MODEL",   "Fracture");

        setDefault(RimDefines::MATRIX_MODEL);
    }
Example #25
0
/*
 *	Initialize System Parameters
 */
static int initSystem(void)
{
	int setDefault(void);

	signal(SIGTSTP, dhcpcHandler);
	signal(SIGUSR2, SIG_IGN);

#if (defined CONFIG_USB) || (defined CONFIG_MMC) 
	signal(SIGTTIN, hotPluglerHandler);
	//hotPluglerHandler(SIGTTIN);
#endif
#ifdef CONFIG_RALINK_RT2880
	signal(SIGUSR1, goaSigHandler);
#else
	goaInitGpio();
#endif
	signal(SIGXFSZ, WPSSingleTriggerHandler);
#if defined (RTDEV_SUPPORT) || defined (CONFIG_RT2561_AP) || defined (CONFIG_RT2561_AP_MODULE)
#ifndef CONFIG_UNIQUE_WPS
	signal(SIGWINCH, RaixWPSSingleTriggerHandler);
#else
	signal(SIGWINCH, WPSSingleTriggerHandler);
#endif
#endif

	if (setDefault() < 0)
		return (-1);
	if (initInternet() < 0)
		return (-1);

	return 0;
}
Example #26
0
 void AppEnum<RimLegendConfig::RangeModeType>::setUp()
 {
     addItem(RimLegendConfig::AUTOMATIC_ALLTIMESTEPS,    "AUTOMATIC_ALLTIMESTEPS",       "All Timesteps");
     addItem(RimLegendConfig::AUTOMATIC_CURRENT_TIMESTEP,"AUTOMATIC_CURRENT_TIMESTEP",   "Current Timestep");
     addItem(RimLegendConfig::USER_DEFINED,              "USER_DEFINED_MAX_MIN",         "User Defined Range");
     setDefault(RimLegendConfig::AUTOMATIC_ALLTIMESTEPS);
 }
Example #27
0
/*
 * CreateMainWindow - create the root window
 */
window_id CreateMainWindow( HANDLE inst )
{
    window_id   root;
    int         maxx, maxy;

    if( initHeight <= 0 || initWidth <= 0 ) {
        setDefault();
    } else {
        maxx = GetSystemMetrics( SM_CXSCREEN );
        maxy = GetSystemMetrics( SM_CYSCREEN );
        if( initX < 0 ) {
            initX = 0;
        } else if( initX >= maxx ) {
            initX = maxx - 50;
        }
        if( initY < 0 ) {
            initY = 0;
        } else if( initY > maxy ) {
            initY = maxy - 50;
        }
        if( initWidth > maxx ) {
            initWidth = maxx;
        }
        if( initHeight > maxy ) {
            initHeight = maxy;
        }
    }

    root = CreateWindow( EditorName, EditorName,
                         WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
                         initX, initY, initWidth, initHeight,
                         (HWND)NULLHANDLE, (HMENU)NULLHANDLE, inst, NULL );
    return( root );

} /* CreateMainWindow */
Example #28
0
void VcsEventWidgetPrivate::diffRevisions()
{
    QModelIndexList l = m_ui->eventView->selectionModel()->selectedRows();
    KDevelop::VcsEvent ev1 = m_logModel->eventForIndex( l.first() );
    KDevelop::VcsEvent ev2 = m_logModel->eventForIndex( l.last() );
    KDevelop::VcsJob* job = m_iface->diff( m_url, ev1.revision(), ev2.revision() );

    VcsDiffWidget* widget = new VcsDiffWidget( job );
    widget->setRevisions( ev1.revision(), ev2.revision() );

    auto dlg = new QDialog( q );
    dlg->setWindowTitle( i18n("Difference between Revisions") );

    widget->connect(widget, &VcsDiffWidget::destroyed, dlg, &QDialog::deleteLater);

    auto mainLayout = new QVBoxLayout(dlg);
    auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
    auto okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    dlg->connect(buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept);
    dlg->connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject);
    mainLayout->addWidget(buttonBox);
    mainLayout->addWidget(widget);
    dlg->show();
}
 void AppEnum<RimTernaryLegendConfig::RangeModeType>::setUp()
 {
     addItem(RimTernaryLegendConfig::AUTOMATIC_ALLTIMESTEPS,    "AUTOMATIC_ALLTIMESTEPS",       "Global range");
     addItem(RimTernaryLegendConfig::AUTOMATIC_CURRENT_TIMESTEP,"AUTOMATIC_CURRENT_TIMESTEP",   "Local range");
     addItem(RimTernaryLegendConfig::USER_DEFINED,              "USER_DEFINED_MAX_MIN",         "User defined range");
     setDefault(RimTernaryLegendConfig::AUTOMATIC_ALLTIMESTEPS);
 }
void RimAnnotationLineAppearance::LineStyle::setUp()
{
    addItem(RimAnnotationLineAppearance::STYLE_SOLID, "STYLE_SOLID", "Solid");
    addItem(RimAnnotationLineAppearance::STYLE_DASH, "STYLE_DASH", "Dashes");

    setDefault(RimAnnotationLineAppearance::STYLE_SOLID);
}