예제 #1
0
void HidingTab::switchPanel(int panelItem)
{
    blockSignals(true);
    ExtensionInfo *panelInfo = (KickerConfig::the()->extensionsInfo())[panelItem];

    if(!panelInfo)
    {
        m_panelList->setCurrentItem(0);
        panelInfo = (KickerConfig::the()->extensionsInfo())[panelItem];

        if(!panelInfo)
        {
            return;
        }
    }

    if(m_panelInfo)
    {
        storeInfo();
    }

    m_panelList->setCurrentItem(panelItem);

    m_panelInfo = panelInfo;

    if(m_panelInfo->_autohidePanel)
    {
        m_automatic->setChecked(true);
    }
    else if(m_panelInfo->_backgroundHide)
    {
        m_background->setChecked(true);
    }
    else
    {
        m_manual->setChecked(true);
    }

    m_delaySpinBox->setValue(m_panelInfo->_autoHideDelay);
    m_autoHideSwitch->setChecked(m_panelInfo->_autoHideSwitch);

    m_lHB->setChecked(m_panelInfo->_showLeftHB);
    m_rHB->setChecked(m_panelInfo->_showRightHB);

    m_animateHiding->setChecked(m_panelInfo->_hideAnim);
    m_hideSlider->setValue(m_panelInfo->_hideAnimSpeed / 10);

    if(m_panelInfo->_unhideLocation > 0)
    {
        m_backgroundRaise->setChecked(true);
        m_backgroundPos->setCurrentItem(triggerConfigToCombo(m_panelInfo->_unhideLocation));
    }
    else
    {
        m_backgroundRaise->setChecked(false);
    }

    panelPositionChanged(m_panelInfo->_position);

    backgroundModeClicked();
    blockSignals(false);
}
예제 #2
0
파일: semLib.c 프로젝트: timburrow/ovj3
int semCreate(key_t key, int initval)
/* key_t key - key to semaphore */
/* int initval - initial value of semaphore */
{
    register int id, semvalue;
    sigset_t signalMask;

    union semun {
        int val;
        struct semid_ds *buf;
        ushort		*array;
    } semctl_arg;


    if ( (key == IPC_PRIVATE) || (key == (key_t) -1) )
    {
        errLogRet(ErrLogOp,debugInfo,"semCreate: Invalid Key given.\n");
        return(-1); /* not for private sems or invalid key */
    }

    blockSignals(&signalMask);  /* block signals while working on the semaphores */

makeitagain:

    if ( (id = semget(key, 3, (SEM_ALL_PERM | IPC_CREAT))) < 0)
    {
        errLogSysRet(ErrLogOp,debugInfo,"semCreate: semget() error");
        unblockSignals(&signalMask);
        return(-1);  /* permission problem or kernel table full */
    }

    /* grab sempore and apply race lock to avoid race conditions */
    if (semop(id, &semLockOps[0], 2) < 0)
    {
        /* some one deleted before we could lock it, make it again Sam */
        if (errno == EINVAL)
            goto makeitagain;
        errLogSysRet(ErrLogOp,debugInfo,
                     "semCreate: semid: semop() can't take locking semaphore");
        semctl(id, 0, IPC_RMID, 0);
        unblockSignals(&signalMask);
        return(-1);
    }

    if ( (semvalue = semctl(id, 1, GETVAL, 0)) < 0 )
    {
        errLogSysRet(ErrLogOp,debugInfo,"semCreate: semid: %d, semctl() can't GETVAL:",
                     id);
        semctl(id, 0, IPC_RMID, 0);
        unblockSignals(&signalMask);
        return(-1);
    }

    if (semvalue == 0)	/* 1st time so initialize values */
    {
        semctl_arg.val = initval;
        if (semctl(id, SEMVALUE, SETVAL, semctl_arg) < 0)
        {
            errLogSysRet(ErrLogOp,debugInfo,
                         "semCreate: semid: %d, semctl() can't SETVAL to SEMVALUE",
                         id);
            semctl(id, 0, IPC_RMID, 0);
            unblockSignals(&signalMask);
            return(-1);
        }

        semctl_arg.val = INITCOUNT;
        if (semctl(id, PROC_CNT, SETVAL, semctl_arg) < 0)
        {
            errLogSysRet(ErrLogOp,debugInfo,
                         "semCreate: semid: %d, semctl() can't SETVAL to PROC_CNT",
                         id);
            semctl(id, 0, IPC_RMID, 0);
            unblockSignals(&signalMask);
            return(-1);
        }
    }

    /* Decrement Process Counter and release Race Lock */
    if (semop(id, &semFinCreatOps[0], 2) < 0)
    {
        errLogSysRet(ErrLogOp,debugInfo,
                     "semCreate: semid: %d, semctl() can't finish create",
                     id);
        semctl(id, 0, IPC_RMID, 0);
        unblockSignals(&signalMask);
        return(-1);
    }

    semDbmAdd(id);

    unblockSignals(&signalMask);

    return(id);
}
예제 #3
0
void TagWidget::setCursorPosition(int position)
{
	blockSignals(true);
	GroupedLineEdit::setCursorPosition(position);
	blockSignals(false);
}
QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c ): QWidget( parent ), mComposition( c )
{
  setupUi( this );
  blockSignals( true );
  createPaperEntries();

  //unit
  mPaperUnitsComboBox->addItem( tr( "mm" ) );
  mPaperUnitsComboBox->addItem( tr( "inch" ) );

  //orientation
  mPaperOrientationComboBox->insertItem( 0, tr( "Landscape" ) );
  mPaperOrientationComboBox->insertItem( 1, tr( "Portrait" ) );
  mPaperOrientationComboBox->setCurrentIndex( 0 );

  //read with/height from composition and find suitable entries to display
  displayCompositionWidthHeight();

  if ( mComposition )
  {
    //read printout resolution from composition
    mResolutionSpinBox->setValue( mComposition->printResolution() );

    //print as raster
    if ( mComposition->printAsRaster() )
    {
      mPrintAsRasterCheckBox->setCheckState( Qt::Checked );
    }
    else
    {
      mPrintAsRasterCheckBox->setCheckState( Qt::Unchecked );
    }

    //snap grid
    if ( mComposition->snapToGridEnabled() )
    {
      mSnapToGridCheckBox->setCheckState( Qt::Checked );
    }
    else
    {
      mSnapToGridCheckBox->setCheckState( Qt::Unchecked );
    }
    mGridResolutionSpinBox->setValue( mComposition->snapGridResolution() );
    mOffsetXSpinBox->setValue( mComposition->snapGridOffsetX() );
    mOffsetYSpinBox->setValue( mComposition->snapGridOffsetY() );


    //grid pen width
    mPenWidthSpinBox->setValue( mComposition->gridPen().widthF() );

    //grid pen color
    mGridColorButton->setColor( mComposition->gridPen().color() );

    mGridStyleComboBox->insertItem( 0, tr( "Solid" ) );
    mGridStyleComboBox->insertItem( 1, tr( "Dots" ) );
    mGridStyleComboBox->insertItem( 2, tr( "Crosses" ) );

    QgsComposition::GridStyle snapGridStyle = mComposition->gridStyle();
    if ( snapGridStyle == QgsComposition::Solid )
    {
      mGridStyleComboBox->setCurrentIndex( 0 );
    }
    else if ( snapGridStyle == QgsComposition::Dots )
    {
      mGridStyleComboBox->setCurrentIndex( 1 );
    }
    else
    {
      mGridStyleComboBox->setCurrentIndex( 2 );
    }
  }
  blockSignals( false );
}
예제 #5
0
QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c ): QWidget( parent ), mComposition( c )
{
    setupUi( this );
    blockSignals( true );
    createPaperEntries();

    //unit
    mPaperUnitsComboBox->addItem( tr( "mm" ) );
    mPaperUnitsComboBox->addItem( tr( "inch" ) );

    //orientation
    mPaperOrientationComboBox->insertItem( 0, tr( "Landscape" ) );
    mPaperOrientationComboBox->insertItem( 1, tr( "Portrait" ) );
    mPaperOrientationComboBox->setCurrentIndex( 0 );

    //read with/height from composition and find suitable entries to display
    displayCompositionWidthHeight();

    if ( mComposition )
    {
        mNumPagesSpinBox->setValue( mComposition->numPages() );

        updatePageStyle();

        //read printout resolution from composition
        mResolutionSpinBox->setValue( mComposition->printResolution() );

        //print as raster
        mPrintAsRasterCheckBox->setChecked( mComposition->printAsRaster() );

        // world file generation
        mGenerateWorldFileCheckBox->setChecked( mComposition->generateWorldFile() );

        // populate the map list
        mWorldFileMapComboBox->clear();
        QList<const QgsComposerMap*> availableMaps = mComposition->composerMapItems();
        QList<const QgsComposerMap*>::const_iterator mapItemIt = availableMaps.constBegin();
        for ( ; mapItemIt != availableMaps.constEnd(); ++mapItemIt )
        {
            mWorldFileMapComboBox->addItem( tr( "Map %1" ).arg(( *mapItemIt )->id() ), qVariantFromValue(( void* )*mapItemIt ) );
        }

        int idx = mWorldFileMapComboBox->findData( qVariantFromValue(( void* )mComposition->worldFileMap() ) );
        if ( idx != -1 )
        {
            mWorldFileMapComboBox->setCurrentIndex( idx );
        }

        // Connect to addition / removal of maps
        connect( mComposition, SIGNAL( composerMapAdded( QgsComposerMap* ) ), this, SLOT( onComposerMapAdded( QgsComposerMap* ) ) );
        connect( mComposition, SIGNAL( itemRemoved( QgsComposerItem* ) ), this, SLOT( onItemRemoved( QgsComposerItem* ) ) );

        mAlignmentToleranceSpinBox->setValue( mComposition->alignmentSnapTolerance() );

        //snap grid
        mGridResolutionSpinBox->setValue( mComposition->snapGridResolution() );
        mOffsetXSpinBox->setValue( mComposition->snapGridOffsetX() );
        mOffsetYSpinBox->setValue( mComposition->snapGridOffsetY() );

        mGridToleranceSpinBox->setValue( mComposition->snapGridTolerance() );
    }
    blockSignals( false );
}
예제 #6
0
 int main (int argc, char **argv) {
  #ifdef CLEAR
  strcpy(table_path, dirname(argv[0]));
  strcat(table_path, "/");
  strcat(table_path, argv[2]);
  shm_unlink(table_path);
  #else
  // verifies if the number of arguments is correct
  if (argc != 4) {
    printf("usage: %s <player's name> <table's name> <nr. players>\n", argv[0]);
    return -1;
  }
  
  if (verifyCmdArgs(argv) == -1) {
    return -1;
  }
  
  // installs an exit handler
  if (atexit(exitHandler) == -1) {
    perror("atexit()");
    exit(-1);
  }
  
  blockSignals();
  
  initFIFO(argv[1]);
  
  initSharedMem(argv);
  
  waitForPlayers();
  
  pthread_t tid;
  
  if (is_dealer) {

    initDefaultDeck();
    printCardsList(cards, NULL);
    shuffleDeck();
    randomiseFirstPlayer();
    
    if ((errno = pthread_create(&tid, NULL, dealCards, NULL)) != 0) {
      perror("pthread_create()");
      exit(-1);
    }
  }
  receiveCards();
  reorderCardsList(hand);
  
  if (is_dealer) {
    pthread_join(tid, NULL);
  }
  //call thread responsible for showing info about the game and manage the game
  pthread_t tidG;
  if ((errno = pthread_create(&tidG, NULL, playGame, NULL)) != 0) {
    perror("pthread_create()");
    exit(-1);
  }
  
  pthread_join(tidG, NULL);
  
  #endif
  return 0;
}
예제 #7
0
void CardView::contentsMousePressEvent( QMouseEvent *e )
{
  Q3ScrollView::contentsMousePressEvent( e );

  QPoint pos = contentsToViewport( e->pos() );
  d->mLastClickPos = e->pos();

  CardViewItem *item = itemAt( e->pos() );

  if ( item == 0 ) {
    d->mLastClickOnItem = false;
    if ( d->mOnSeparator) {
      d->mResizeAnchor = e->x() + contentsX();
      d->mColspace = (2 * d->mItemSpacing);
      int ccw = d->mItemWidth + d->mColspace + d->mSepWidth;
      d->mFirst = (contentsX() + d->mSepWidth) / ccw;
      d->mPressed = (d->mResizeAnchor + d->mSepWidth) / ccw;
      d->mSpan = d->mPressed - d->mFirst;
      d->mFirstX = d->mFirst * ccw;
      if ( d->mFirstX )
        d->mFirstX -= d->mSepWidth;
    } else {
      selectAll( false );
    }

    return;
  }

  d->mLastClickOnItem = true;

  CardViewItem *other = d->mCurrentItem;
  setCurrentItem( item );

  // Always emit the selection
  emit clicked( item );

  // The RMB click
  if ( e->button() & Qt::RightButton ) {
    // select current item
    item->setSelected( true );

    emit contextMenuRequested( item, mapToGlobal( pos ) );
    return;
  }

  // Check the selection type and update accordingly
  if ( d->mSelectionMode == CardView::Single ) {
    // make sure it isn't already selected
    if ( item->isSelected() )
      return;

    bool b = signalsBlocked();
    blockSignals( true );
    selectAll( false );
    blockSignals( b );

    item->setSelected( true );
    item->repaintCard();
    emit selectionChanged( item );
  } else if ( d->mSelectionMode == CardView::Multi ) {
    // toggle the selection
    item->setSelected( !item->isSelected() );
    item->repaintCard();
    emit selectionChanged();
  } else if ( d->mSelectionMode == CardView::Extended ) {
    if ( (e->button() & Qt::LeftButton) && (e->modifiers() & Qt::ShiftModifier) ) {
      if ( item == other )
        return;

      bool s = !item->isSelected();

      if ( s && !(e->modifiers() & Qt::ControlModifier) ) {
        bool b = signalsBlocked();
        blockSignals( true );
        selectAll( false );
        blockSignals( b );
      }

      int from, to, a, b;
      a = d->mItemList.findRef( item );
      b = d->mItemList.findRef( other );
      from = a < b ? a : b;
      to = a > b ? a : b;

      CardViewItem *aItem;
      for ( ; from <= to; ++from ) {
        aItem = d->mItemList.at( from );
        aItem->setSelected( s );
        repaintItem( aItem );
      }

      emit selectionChanged();
    } else if ( (e->button() & Qt::LeftButton) && (e->modifiers() & Qt::ControlModifier) ) {
      item->setSelected( !item->isSelected() );
      item->repaintCard();
      emit selectionChanged();
    } else if ( e->button() & Qt::LeftButton ) {
      bool b = signalsBlocked();
      blockSignals( true );
      selectAll( false );
      blockSignals( b );

      item->setSelected( true );
      item->repaintCard();
      emit selectionChanged();
    }
  }
}
예제 #8
0
void ENT_GeometryOutln::Event_SetPosition(const SetEntityVectorEvent& event) {
    UI::BlockSignals blockSignals(_sbPosition[0], _sbPosition[1], _sbPosition[2]);
    _sbPosition[0]->setValue(event.m_vector[0]);
    _sbPosition[1]->setValue(event.m_vector[1]);
    _sbPosition[2]->setValue(event.m_vector[2]);
}
예제 #9
0
QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c ): QWidget( parent ), mComposition( c )
{
  setupUi( this );
  blockSignals( true );
  createPaperEntries();

  //unit
  mPaperUnitsComboBox->addItem( tr( "mm" ) );
  mPaperUnitsComboBox->addItem( tr( "inch" ) );

  //orientation
  mPaperOrientationComboBox->insertItem( 0, tr( "Landscape" ) );
  mPaperOrientationComboBox->insertItem( 1, tr( "Portrait" ) );
  mPaperOrientationComboBox->setCurrentIndex( 0 );

  //read with/height from composition and find suitable entries to display
  displayCompositionWidthHeight();

  if ( mComposition )
  {
    mNumPagesSpinBox->setValue( mComposition->numPages() );
    connect( mComposition, SIGNAL( nPagesChanged() ), this, SLOT( setNumberPages() ) );

    updatePageStyle();

    //read printout resolution from composition
    mResolutionSpinBox->setValue( mComposition->printResolution() );

    //print as raster
    mPrintAsRasterCheckBox->setChecked( mComposition->printAsRaster() );

    // world file generation
    mGenerateWorldFileCheckBox->setChecked( mComposition->generateWorldFile() );

    // populate the map list
    mWorldFileMapComboBox->clear();
    QList<const QgsComposerMap*> availableMaps = mComposition->composerMapItems();
    QList<const QgsComposerMap*>::const_iterator mapItemIt = availableMaps.constBegin();
    for ( ; mapItemIt != availableMaps.constEnd(); ++mapItemIt )
    {
      mWorldFileMapComboBox->addItem( tr( "Map %1" ).arg(( *mapItemIt )->id() ), qVariantFromValue(( void* )*mapItemIt ) );
    }

    int idx = mWorldFileMapComboBox->findData( qVariantFromValue(( void* )mComposition->worldFileMap() ) );
    if ( idx != -1 )
    {
      mWorldFileMapComboBox->setCurrentIndex( idx );
    }

    // Connect to addition / removal of maps
    connect( mComposition, SIGNAL( composerMapAdded( QgsComposerMap* ) ), this, SLOT( onComposerMapAdded( QgsComposerMap* ) ) );
    connect( mComposition, SIGNAL( itemRemoved( QgsComposerItem* ) ), this, SLOT( onItemRemoved( QgsComposerItem* ) ) );

    mSnapToleranceSpinBox->setValue( mComposition->snapTolerance() );

    //snap grid
    mGridResolutionSpinBox->setValue( mComposition->snapGridResolution() );
    mOffsetXSpinBox->setValue( mComposition->snapGridOffsetX() );
    mOffsetYSpinBox->setValue( mComposition->snapGridOffsetY() );

    QgsAtlasComposition* atlas = &mComposition->atlasComposition();
    if ( atlas )
    {
      // repopulate data defined buttons if atlas layer changes
      connect( atlas, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ),
               this, SLOT( populateDataDefinedButtons() ) );
      connect( atlas, SIGNAL( toggled( bool ) ), this, SLOT( populateDataDefinedButtons() ) );
    }
  }

  connect( mPaperSizeDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mPaperSizeDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mPaperSizeDDBtn, SIGNAL( dataDefinedActivated( bool ) ), mPaperSizeComboBox, SLOT( setDisabled( bool ) ) );
  connect( mPaperWidthDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mPaperWidthDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mPaperWidthDDBtn, SIGNAL( dataDefinedActivated( bool ) ), mPaperWidthDoubleSpinBox, SLOT( setDisabled( bool ) ) );
  connect( mPaperHeightDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mPaperHeightDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mPaperHeightDDBtn, SIGNAL( dataDefinedActivated( bool ) ), mPaperHeightDoubleSpinBox, SLOT( setDisabled( bool ) ) );
  connect( mNumPagesDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mNumPagesDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mNumPagesDDBtn, SIGNAL( dataDefinedActivated( bool ) ), mNumPagesSpinBox, SLOT( setDisabled( bool ) ) );
  connect( mPaperOrientationDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mPaperOrientationDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mPaperOrientationDDBtn, SIGNAL( dataDefinedActivated( bool ) ), mPaperOrientationComboBox, SLOT( setDisabled( bool ) ) );

  //initialize data defined buttons
  populateDataDefinedButtons();

  blockSignals( false );
}
예제 #10
0
void ENT_GeometryOutln::Event_XrayVertexLabels(const EV::Arg<bool>& event) {
    UI::BlockSignals blockSignals(_cbXrayVertexLabels);
    _cbXrayVertexLabels->setChecked(event.value);
}
예제 #11
0
void ENT_GeometryOutln::Event_SetVertexLabelSize(const EV::Arg<float>& event) {
    UI::BlockSignals blockSignals(_sbVertexLabelSize);
    _sbVertexLabelSize->setValue(event.value);
}
예제 #12
0
void ENT_GeometryOutln::Event_RenderModeChanged(const RenderModeEvent& event) {
    UI::BlockSignals blockSignals(_btnRenderVertices, _btnRenderEdges, _btnRenderFaces);
    _btnRenderVertices->setChecked(NB::RM_NODES & event.renderMode);
    _btnRenderEdges->setChecked(NB::RM_EDGES & event.renderMode);
    _btnRenderFaces->setChecked(NB::RM_FACES & event.renderMode);
}
예제 #13
0
void ENT_GeometryOutln::Event_EdgeShadingChanged(const EdgeShadingEvent& event) {
    UI::BlockSignals blockSignals(_btnRenderVertices, _btnRenderEdges, _btnRenderFaces);
    _cbEdgeShading->setCurrentIndex(event.shadingMode);
    _cbHiddenLines->setChecked(event.showHiddenLines);
}
예제 #14
0
void QxPreferences::restore(QSettings* settings, int selection)
{
	blockSignals(true);
	settings->beginGroup("preferences");
	
	Ref<ViewMetrics, Owner> editorDefaults = Edit::defaultMetrics();
	Ref<ViewMetrics, Owner> terminalDefaults = QxVideoTerminal::defaultMetrics();
	
	if ((selection & Editor) != 0) {
		settings->beginGroup("editor");
		setFontFamily(editor_->font_, settings->value("font"), editorDefaults->font_);
		editor_->fontSize_->setValue(settings->value("fontSize", editorDefaults->font_.pixelSize()).toInt());
		editor_->fontAntialiasing_->setChecked(settings->value("fontAntialiasing", editorDefaults->fontAntialiasing_).toBool());
		editor_->subpixelAntialiasing_->setChecked(!settings->value("speedOverQuality", !editorDefaults->subpixelAntialiasing_).toBool());
		editor_->lineSpacing_->setValue(settings->value("lineSpacing", editorDefaults->lineSpacing_).toInt());
		editor_->showLineNumbers_->setChecked(settings->value("showLineNumbers", editorDefaults->showLineNumbers_).toBool());
		editor_->showWhitespace_->setChecked(settings->value("showWhitespace", editorDefaults->showWhitespace_).toBool());
		editor_->autoIndent_->setChecked(settings->value("autoIndent", true).toBool());
		{
			bool on = settings->value("tabIndentMode", true).toBool();
			if (on)
				editor_->tabIndentMode_->setChecked(true);
			else
				editor_->spaceIndentMode_->setChecked(true);
		}
		editor_->tabWidth_->setValue(settings->value("tabWidth", editorDefaults->tabWidth_).toInt());
		editor_->indentWidth_->setValue(settings->value("indentWidth", editorDefaults->tabWidth_).toInt());
		settings->endGroup();
	}
	
	if ((selection & Terminal) != 0) {
		settings->beginGroup("terminal");
		setFontFamily(terminal_->font_, settings->value("font"), terminalDefaults->font_);
		terminal_->fontSize_->setValue(settings->value("fontSize", terminalDefaults->font_.pixelSize()).toInt());
		terminal_->fontAntialiasing_->setChecked(settings->value("fontAntialiasing", terminalDefaults->fontAntialiasing_).toBool());
		terminal_->subpixelAntialiasing_->setChecked(!settings->value("speedOverQuality", !terminalDefaults->subpixelAntialiasing_).toBool());
		terminal_->lineSpacing_->setValue(settings->value("lineSpacing", terminalDefaults->lineSpacing_).toInt());
		terminal_->endlessLogging_->setChecked(settings->value("endlessLogging", true).toBool());
		terminal_->numberOfLines_->setValue(settings->value("numberOfLines", terminal_->numberOfLines_->maximum()).toInt());
		{
			Ref<Palette> palette = paletteManager_->paletteByName(settings->value("palette", "Default").toString());
			for (int i = 0, n = paletteIndices_.length(); i < n; ++i)
				if (paletteManager_->paletteByIndex(paletteIndices_.at(i)) == palette)
					terminal_->palette_->setCurrentIndex(i);
		}
		{
			QString title = settings->value("title", "$FG").toString();
			int titleIndex = terminal_->title_->findText(title);
			if (titleIndex != -1) terminal_->title_->setCurrentIndex(titleIndex);
			else terminal_->title_->setEditText(title);
		}
		settings->endGroup();
	}
	
	if ((selection & Printing) != 0) {
		settings->beginGroup("printing");
		setFontFamily(printing_->font_, settings->value("font"), editorDefaults->font_);
		printing_->fontSize_->setValue(settings->value("fontSize", 10).toInt());
		printing_->fontAntialiasing_->setChecked(settings->value("fontAntialiasing", editorDefaults->fontAntialiasing_).toBool());
		printing_->lineSpacing_->setValue(settings->value("lineSpacing", 1).toInt());
		printing_->showLineNumbers_->setChecked(settings->value("showLineNumbers", editorDefaults->showLineNumbers_).toBool());
		printing_->showWhitespace_->setChecked(settings->value("showWhitespace", false).toBool());
		printing_->pageHeader_->setChecked(settings->value("printingPageHeader", true).toBool());
		printing_->pageBorder_->setChecked(settings->value("printingPageBorder", true).toBool());
		settings->endGroup();
	}
	
	if ((selection & Theme) != 0) {
		settings->beginGroup("theme");
		if (settings->contains("activeTheme"))
			themesView_->setCurrentIndex(themesView_->model()->index(themeManager_->themeIndex(settings->value("activeTheme").toString()), 0));
		else
			themesView_->setCurrentIndex(themesView_->model()->index(themeManager_->defaultThemeIndex(), 0));
		settings->endGroup();
	}
	
	if ((selection & Commands) != 0) {
		settings->beginGroup("commands");
		{
			QVariantList list = settings->value("commands", QVariantList()).toList();
			commandsList_->clear();
			for (int i = 0; i < list.size(); ++i) {
				QxCommand* cmd = new QxCommand(parent());
				connect(cmd, SIGNAL(triggered(QxCommand*)), this, SIGNAL(commandTriggered(QxCommand*)));
				QAction* action = new QAction(parent());
				// parentWidget()->addAction(action);
				cmd->assignAction(action);
				QVariantList al = list.at(i).toList();
				cmd->restore(list.at(i).toList());
				cmd->updateAction();
				commandsList_->append(cmd);
			}
			// commands_->view_->resizeColumnToContents(0);
		}
		settings->endGroup();
	}
예제 #15
0
void BasicTab::setEntryInfo(MenuEntryInfo *entryInfo)
{
    blockSignals(true);
    _menuFolderInfo = 0;
    _menuEntryInfo = entryInfo;

    if (!entryInfo)
    {
       _nameEdit->clear();
       _descriptionEdit->clear();
       _commentEdit->clear();
       _iconButton->setIcon( QString() );

       // key binding part
       _keyEdit->clearKeySequence();

       _execEdit->lineEdit()->clear();
       _systrayCB->setChecked(false);
       _onlyShowInKdeCB->setChecked( false );
       _hiddenEntryCB->setChecked( false );

       _pathEdit->lineEdit()->clear();
       _termOptEdit->clear();
       _uidEdit->clear();

       _launchCB->setChecked(false);
       _terminalCB->setChecked(false);
       _uidCB->setChecked(false);
       enableWidgets(true, true);
       blockSignals(false);
       return;
    }

    KDesktopFile *df = entryInfo->desktopFile();

    _nameEdit->setText(df->readName());
    _descriptionEdit->setText(df->readGenericName());
    _descriptionEdit->setCursorPosition(0);
    _commentEdit->setText(df->readComment());
    _commentEdit->setCursorPosition(0);
    _iconButton->setIcon(df->readIcon());

    // key binding part
#ifndef Q_WS_WIN
    if( KHotKeys::present())
    {
        if ( !entryInfo->shortcut().isEmpty() )
            _keyEdit->setKeySequence( entryInfo->shortcut().primary() );
        else
            _keyEdit->clearKeySequence();
    }
#endif
    QString temp = df->desktopGroup().readEntry("Exec");
    if (temp.startsWith("ksystraycmd "))
    {
      _execEdit->lineEdit()->setText(temp.right(temp.length()-12));
      _systrayCB->setChecked(true);
    }
    else
    {
      _execEdit->lineEdit()->setText(temp);
      _systrayCB->setChecked(false);
    }

    _pathEdit->lineEdit()->setText(df->readPath());
    _termOptEdit->setText(df->desktopGroup().readEntry("TerminalOptions"));
    _uidEdit->setText(df->desktopGroup().readEntry("X-KDE-Username"));

    if( df->desktopGroup().hasKey( "StartupNotify" ))
        _launchCB->setChecked(df->desktopGroup().readEntry("StartupNotify", true));
    else // backwards comp.
        _launchCB->setChecked(df->desktopGroup().readEntry("X-KDE-StartupNotify", true));

    _onlyShowInKdeCB->setChecked( df->desktopGroup().readXdgListEntry("OnlyShowIn").contains( "KDE" ) ); // or maybe enable only if it contains nothing but KDE?
    
    if ( df->desktopGroup().hasKey( "NoDisplay" ) )
        _hiddenEntryCB->setChecked( df->desktopGroup().readEntry( "NoDisplay", true ) );
    else
        _hiddenEntryCB->setChecked( false );

    if(df->desktopGroup().readEntry("Terminal", 0) == 1)
        _terminalCB->setChecked(true);
    else
        _terminalCB->setChecked(false);

    _uidCB->setChecked(df->desktopGroup().readEntry("X-KDE-SubstituteUID", false));

    enableWidgets(true, entryInfo->hidden);
    blockSignals(false);
}
예제 #16
0
void TaskWareHouse::stopTaskComputing()
{
    blockSignals(true);
}
예제 #17
0
int QCustomToolBar::updateUi(cogx::display::CDisplayModel *pModel, const cogx::display::CDisplayViewPtr& pView)
{
   DTRACE("QCustomToolBar::updateUi");
   if (m_pView) m_pView->viewObservers -= this;

   removeUi();

   m_pView = pView;
   if (!pModel || !pView) return 0;

   CPtrVector<cogx::display::CGuiElement> elements;
   pModel->getGuiElements(pView->m_id, elements);
   if (elements.size() < 1) return 0;

   bool sigBlocked = blockSignals(true);
   m_controlCount = 0;

   // Create new widgets
   cogx::display::CGuiElement* pgel;
   CChangeSlot *pSlot;
   QToolBar *pBar = this;

   FOR_EACH(pgel, elements) {
      if (!pgel) continue;
      if (pgel->m_type != cogx::display::CGuiElement::wtAction)
         continue;
      QToolButton *pBtn;
      QIcon icon;
      pBtn = new QToolButton(pBar);
      QString text = QString::fromStdString(pgel->m_iconLabel);
      if (pgel->m_iconSvg.length() > 0) {
         if (strncmp(pgel->m_iconSvg.c_str(), "text:", 5) == 0) {
            QString sym = QString::fromStdString(pgel->m_iconSvg.substr(5));
            QPixmap pixmap(22, 22);
            pixmap.fill(QColor(0, 0, 0, 0));
            QPainter p(&pixmap);
            QRect r = p.fontMetrics().boundingRect(sym);
            int x = (22 - r.width()) / 2;
            if (x < 0) x = 0;
            int y = (22 - r.height()) / 2;
            if (y < 0) y = 0;
            y = 20 - y;
            p.drawText(QPointF(x, y), sym);
            icon = QIcon(pixmap);
         }
      }
      QAction* pAct = new QAction(icon, text, pBtn);
      pAct->setToolTip(QString::fromStdString(pgel->m_tooltip));
      pAct->setCheckable(pgel->m_bCheckable);
      pBtn->setDefaultAction(pAct);
      pBar->addWidget(pBtn);
      CChangeSlot* pSlot = new CChangeSlot(pgel, pView, pAct);
      connect(pAct, SIGNAL(triggered(bool)), pSlot, SLOT(onButtonClick(bool)));
      ++m_controlCount;
   }

   if (pView) pView->viewObservers += this;

   blockSignals(sigBlocked);
   return m_controlCount;
}
void PreviewTable::importASCII(const QString &fname, const QString &sep, int ignoredLines, bool renameCols,
    bool stripSpaces, bool simplifySpaces, bool importComments, const QString& commentString,
	int importMode, int endLine, int maxRows)
{
	int rows;
	QString name = MdiSubWindow::parseAsciiFile(fname, commentString, endLine, ignoredLines, maxRows, rows);
	if (name.isEmpty())
		return;

	QFile f(name);
	if (f.open(QIODevice::ReadOnly)){
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

        QTextStream t(&f);
		QString s = t.readLine();//read first line
		if (simplifySpaces)
			s = s.simplifyWhiteSpace();
		else if (stripSpaces)
			s = s.stripWhiteSpace();

		QStringList line = s.split(sep);
		int cols = line.size();

		bool allNumbers = true;
		for (int i=0; i<cols; i++)
		{//verify if the strings in the line used to rename the columns are not all numbers
			locale().toDouble(line[i], &allNumbers);
			if (!allNumbers)
				break;
		}
        if (renameCols && !allNumbers){
            rows--;
            if (importComments)
                rows--;
        }

        int startRow = 0, startCol = 0;
        int c = numCols();
        int r = numRows();
		switch(importMode){
			case Table::Overwrite:
                if (numRows() != rows)
                    setNumRows(rows);

                if (c != cols){
                    if (c < cols)
                        addColumns(cols - c);
                    else
                        setNumCols(cols);
                }
			break;
			case Table::NewColumns:
                startCol = c;
                addColumns(cols);
                if (r < rows)
                    setNumRows(rows);
			break;
			case Table::NewRows:
                startRow = r;
                if (c < cols)
                    addColumns(cols - c);
                setNumRows(r + rows);
			break;
		}

		if (renameCols && !allNumbers){//use first line to set the table header
			for (int i = 0; i<cols; i++){
			    int aux = i + startCol;
                col_label[aux] = QString::null;
			    if (!importComments)
                    comments[aux] = line[i];
				s = line[i].replace("-","_").remove(QRegExp("\\W")).replace("_","-");
				int n = col_label.count(s);
				if(n){//avoid identical col names
					while (col_label.contains(s + QString::number(n)))
						n++;
					s += QString::number(n);
				}
				col_label[aux] = s;
			}

            if (importComments){//import comments
                s = t.readLine();//read 2nd line
                if (simplifySpaces)
                    s = s.simplifyWhiteSpace();
                else if (stripSpaces)
                    s = s.stripWhiteSpace();
                line = s.split(sep, QString::SkipEmptyParts);
                for (int i=0; i<line.size(); i++){
					int aux = startCol + i;
					if (aux < comments.size())
                    	comments[aux] = line[i];
				}
                qApp->processEvents(QEventLoop::ExcludeUserInput);
            }
        } else if (rows > 0){//put values in the first line of the table
            for (int i = 0; i<cols; i++)
				setText(startRow, startCol + i, line[i]);
            startRow++;
        }

        blockSignals(true);
		setHeader();

        QApplication::restoreOverrideCursor();

		int row = startRow;
		rows = numRows();
		while (!t.atEnd() && row < rows){
		    s = t.readLine();
			if (simplifySpaces)
				s = s.simplifyWhiteSpace();
			else if (stripSpaces)
				s = s.stripWhiteSpace();
			line = s.split(sep);
			int lc = line.size();
			if (lc > cols) {
				addColumns(lc - cols);
				cols = lc;
			}
			for (int j=0; j<cols && j<lc; j++)
				setText(row, startCol + j, line[j]);

            row++;
            qApp->processEvents(QEventLoop::ExcludeUserInput);
		}
		blockSignals(false);
		f.remove();
	}
}
예제 #19
0
void CardView::keyPressEvent( QKeyEvent *e )
{
  if ( !(childCount() && d->mCurrentItem) ) {
    e->ignore();
    return;
  }

  uint pos = d->mItemList.findRef( d->mCurrentItem );
  CardViewItem *aItem = 0;
  CardViewItem *old = d->mCurrentItem;

  switch ( e->key() ) {
    case Qt::Key_Up:
      if ( pos > 0 ) {
        aItem = d->mItemList.at( pos - 1 );
        setCurrentItem( aItem );
      }
      break;
    case Qt::Key_Down:
      if ( pos < d->mItemList.count() - 1 ) {
        aItem = d->mItemList.at( pos + 1 );
        setCurrentItem( aItem );
      }
      break;
    case Qt::Key_Left:
    {
      // look for an item in the previous/next column, starting from
      // the vertical middle of the current item.
      // FIXME use nice calculatd measures!!!
      QPoint aPoint( d->mCurrentItem->d->x, d->mCurrentItem->d->y );
      aPoint -= QPoint( 30, -(d->mCurrentItem->height() / 2) );
      aItem = itemAt( aPoint );
      // maybe we hit some space below an item
      while ( !aItem && aPoint.y() > 27 ) {
        aPoint -= QPoint( 0, 16 );
        aItem = itemAt( aPoint );
      }
      if ( aItem )
        setCurrentItem( aItem );

      break;
    }
    case Qt::Key_Right:
    {
      // FIXME use nice calculated measures!!!
      QPoint aPoint( d->mCurrentItem->d->x + d->mItemWidth, d->mCurrentItem->d->y );
      aPoint += QPoint( 30, (d->mCurrentItem->height() / 2) );
      aItem = itemAt( aPoint );
      while ( !aItem && aPoint.y() > 27 ) {
        aPoint -= QPoint( 0, 16 );
        aItem = itemAt( aPoint );
      }
      if ( aItem )
        setCurrentItem( aItem );

      break;
    }
    case Qt::Key_Home:
      aItem = d->mItemList.first();
      setCurrentItem( aItem );
      break;
    case Qt::Key_End:
      aItem = d->mItemList.last();
      setCurrentItem( aItem );
      break;
    case Qt::Key_PageUp: // PageUp
    {
      // QListView: "Make the item above the top visible and current"
      // TODO if contentsY(), pick the top item of the leftmost visible column
      if ( contentsX() <= 0 )
        return;
      int cw = columnWidth();
      int theCol = ( qMax( 0, ( contentsX() / cw) * cw ) ) + d->mItemSpacing;
      aItem = itemAt( QPoint( theCol + 1, d->mItemSpacing + 1 ) );
      if ( aItem )
        setCurrentItem( aItem );

      break;
    }
    case Qt::Key_PageDown:  // PageDown
    {
      // QListView: "Make the item below the bottom visible and current"
      // find the first not fully visible column.
      // TODO: consider if a partly visible (or even hidden) item at the
      //       bottom of the rightmost column exists
      int cw = columnWidth();
      int theCol = ( (( contentsX() + visibleWidth() ) / cw) * cw ) + d->mItemSpacing + 1;
      // if separators are on, we may need to we may be one column further right if only the spacing/sep is hidden
      if ( d->mDrawSeparators && cw - (( contentsX() + visibleWidth() ) % cw) <= int( d->mItemSpacing + d->mSepWidth ) )
        theCol += cw;

      // make sure this is not too far right
      while ( theCol > contentsWidth() )
        theCol -= columnWidth();

      aItem = itemAt( QPoint( theCol, d->mItemSpacing + 1 ) );

      if ( aItem )
        setCurrentItem( aItem );

      break;
    }
    case Qt::Key_Space:
      setSelected( d->mCurrentItem, !d->mCurrentItem->isSelected() );
      emit selectionChanged();
      break;
    case Qt::Key_Return:
    case Qt::Key_Enter:
      emit returnPressed( d->mCurrentItem );
      emit executed( d->mCurrentItem );
      break;
    case Qt::Key_Menu:
      emit contextMenuRequested( d->mCurrentItem, viewport()->mapToGlobal(
                                 itemRect(d->mCurrentItem).center() ) );
      break;
    default:
      if ( (e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_A ) {
        // select all
        selectAll( true );
        break;
      } else if ( !e->text().isEmpty() && e->text()[ 0 ].isPrint() ) {
        // if we have a string, do autosearch
      }
      break;
  }

  // handle selection
  if ( aItem ) {
    if ( d->mSelectionMode == CardView::Extended ) {
      if ( e->modifiers() & Qt::ShiftModifier ) {
        // shift button: toggle range
        // if control button is pressed, leave all items
        // and toggle selection current->old current
        // otherwise, ??????
        bool s = ! aItem->isSelected();
        int from, to, a, b;
        a = d->mItemList.findRef( aItem );
        b = d->mItemList.findRef( old );
        from = a < b ? a : b;
        to = a > b ? a : b;

        if ( to - from > 1 ) {
          bool b = signalsBlocked();
          blockSignals( true );
          selectAll( false );
          blockSignals( b );
        }

        CardViewItem *item;
        for ( ; from <= to; ++from ) {
          item = d->mItemList.at( from );
          item->setSelected( s );
          repaintItem( item );
        }

        emit selectionChanged();
      } else if ( e->modifiers() & Qt::ControlModifier ) {
        // control button: do nothing
      } else {
        // no button: move selection to this item
        bool b = signalsBlocked();
        blockSignals( true );
        selectAll( false );
        blockSignals( b );

        setSelected( aItem, true );
        emit selectionChanged();
      }
    }
  }
}
예제 #20
0
void CustomFileDialog::setDir2( const QString &s )
{
  blockSignals( true );
  setDir( s );
  blockSignals( false );
}
예제 #21
0
파일: umlrole.cpp 프로젝트: KDE/umbrello
/**
 * Loads the <UML:AssociationEnd> XMI element.
 * Auxiliary to UMLObject::loadFromXMI.
 */
bool UMLRole::load(QDomElement & element)
{
    UMLDoc * doc = UMLApp::app()->document();
    QString type = element.attribute(QLatin1String("type"));
    if (!type.isEmpty()) {
        if (!m_SecondaryId.isEmpty())
            uWarning() << "overwriting old m_SecondaryId \"" << m_SecondaryId
                << " with new value \"" << type << "\"";
        m_SecondaryId = type;
    }
    // Inspect child nodes - for multiplicity (and type if not set above.)
    for (QDomNode node = element.firstChild(); !node.isNull(); node = node.nextSibling()) {
        if (node.isComment())
            continue;
        QDomElement tempElement = node.toElement();
        QString tag = tempElement.tagName();
        if (UMLDoc::tagEq(tag, QLatin1String("name"))) {
            m_name = tempElement.text();
        } else if (UMLDoc::tagEq(tag, QLatin1String("AssociationEnd.multiplicity"))) {
            /*
             * There are different ways in which the multiplicity might be given:
             *  - direct value in the <AssociationEnd.multiplicity> tag,
             *  - attributes "lower" and "upper" of a subordinate <MultiplicityRange>,
             *  - direct value in subordinate <MultiplicityRange.lower> and
             *    <MultiplicityRange.upper> tags
             */
            QDomNode n = tempElement.firstChild();
            if (node.isNull() || tempElement.isNull() || n.isNull() ||
                    n.toElement().isNull()) {
                m_Multi = tempElement.text().trimmed();
                continue;
            }
            tempElement = n.toElement();
            tag = tempElement.tagName();
            if (!UMLDoc::tagEq(tag, QLatin1String("Multiplicity"))) {
                m_Multi = tempElement.text().trimmed();
                continue;
            }
            n = tempElement.firstChild();
            tempElement = n.toElement();
            tag = tempElement.tagName();
            if (!UMLDoc::tagEq(tag, QLatin1String("Multiplicity.range"))) {
                m_Multi = tempElement.text().trimmed();
                continue;
            }
            n = tempElement.firstChild();
            tempElement = n.toElement();
            tag = tempElement.tagName();
            if (!UMLDoc::tagEq(tag, QLatin1String("MultiplicityRange"))) {
                m_Multi = tempElement.text().trimmed();
                continue;
            }
            QString multiUpper;
            if (tempElement.hasAttribute(QLatin1String("lower"))) {
                m_Multi = tempElement.attribute(QLatin1String("lower"));
                multiUpper = tempElement.attribute(QLatin1String("upper"));
                if (!multiUpper.isEmpty()) {
                    if (!m_Multi.isEmpty())
                        m_Multi.append(QLatin1String(".."));
                    m_Multi.append(multiUpper);
                }
                continue;
            }
            n = tempElement.firstChild();
            while (!n.isNull()) {
                tempElement = n.toElement();
                tag = tempElement.tagName();
                if (UMLDoc::tagEq(tag, QLatin1String("MultiplicityRange.lower"))) {
                    m_Multi = tempElement.text();
                } else if (UMLDoc::tagEq(tag, QLatin1String("MultiplicityRange.upper"))) {
                    multiUpper = tempElement.text();
                }
                n = n.nextSibling();
            }
            if (!multiUpper.isEmpty()) {
                if (!m_Multi.isEmpty())
                    m_Multi.append(QLatin1String(".."));
                m_Multi.append(multiUpper);
            }
        } else if (m_SecondaryId.isEmpty() &&
                   (UMLDoc::tagEq(tag, QLatin1String("type")) ||
                    UMLDoc::tagEq(tag, QLatin1String("participant")))) {
            m_SecondaryId = tempElement.attribute(QLatin1String("xmi.id"));
            if (m_SecondaryId.isEmpty())
                m_SecondaryId = tempElement.attribute(QLatin1String("xmi.idref"));
            if (m_SecondaryId.isEmpty()) {
                QDomNode inner = tempElement.firstChild();
                QDomElement innerElem = inner.toElement();
                m_SecondaryId = innerElem.attribute(QLatin1String("xmi.id"));
                if (m_SecondaryId.isEmpty())
                    m_SecondaryId = innerElem.attribute(QLatin1String("xmi.idref"));
            }
        }
    }
    if (!m_Multi.isEmpty())
        uDebug() << name() << ": m_Multi is " << m_Multi;
    if (m_SecondaryId.isEmpty()) {
        uError() << name() << ": type not given or illegal";
        return false;
    }
    UMLObject * obj;
    obj = doc->findObjectById(Uml::ID::fromString(m_SecondaryId));
    if (obj) {
        m_pSecondary = obj;
        m_SecondaryId = QString();
    }

    // block signals to prevent needless updating
    blockSignals(true);
    // Here comes the handling of the association type.
    // This is open for discussion - I'm pretty sure there are better ways..

    // Yeah, for one, setting the *parent* object parameters from here is sucky
    // as hell. Why are we using roleA to store what is essentially a parent (association)
    // parameter, eh? The UML13.dtd is pretty silly, but since that is what
    // is driving us to that point, we have to go with it. Some analysis of
    // the component roles/linked items needs to be done in order to get things
    // right. *sigh* -b.t.

    // Setting association type from the role (A)
    // Determination of the "aggregation" attribute used to be done only
    // when (m_role == Uml::RoleType::A) but some XMI writers (e.g. StarUML) place
    // the aggregation attribute at role B.
    // The role end with the aggregation unequal to "none" wins.
    QString aggregation = element.attribute(QLatin1String("aggregation"), QLatin1String("none"));
    if (aggregation == QLatin1String("composite"))
        m_pAssoc->setAssociationType(Uml::AssociationType::Composition);
    else if (aggregation == QLatin1String("shared")       // UML1.3
          || aggregation == QLatin1String("aggregate"))   // UML1.4
        m_pAssoc->setAssociationType(Uml::AssociationType::Aggregation);

    if (!element.hasAttribute(QLatin1String("isNavigable"))) {
        // Backward compatibility mode: In Umbrello version 1.3.x the
        // logic for saving the isNavigable flag was wrong.
        // May happen on loading role A.
        m_pAssoc->setOldLoadMode(true);
    } else if (m_pAssoc->getOldLoadMode() == true) {
        // Here is the original logic:
        // "Role B:
        //  If isNavigable is not given, we make no change to the
        //  association type.
        //  If isNavigable is given, and is "true", then we assume that
        //  the association's other end (role A) is not navigable, and
        //  therefore we change the association type to UniAssociation.
        //  The case that isNavigable is given as "false" is ignored.
        //  Combined with the association type logic for role A, this
        //  allows us to support at_Association and at_UniAssociation."
        if (element.attribute(QLatin1String("isNavigable")) == QLatin1String("true"))
            m_pAssoc->setAssociationType(Uml::AssociationType::UniAssociation);
    } else if (element.attribute(QLatin1String("isNavigable")) == QLatin1String("false")) {
        m_pAssoc->setAssociationType(Uml::AssociationType::UniAssociation);
    }

    //FIXME not standard XMI
    if (element.hasAttribute(QLatin1String("relationship"))) {
        if (element.attribute(QLatin1String("relationship")) == QLatin1String("true")) {
            m_pAssoc->setAssociationType(Uml::AssociationType::Relationship);
        }
    }

    if (m_Multi.isEmpty())
        m_Multi = element.attribute(QLatin1String("multiplicity"));

    // Changeability defaults to Changeable if it cant set it here..
    m_Changeability = Uml::Changeability::Changeable;
    QString changeability = element.attribute(QLatin1String("changeability"));
    if (changeability.isEmpty())
        element.attribute(QLatin1String("changeable"));  // for backward compatibility
    if (changeability == QLatin1String("frozen"))
        m_Changeability = Uml::Changeability::Frozen;
    else if (changeability == QLatin1String("addOnly"))
        m_Changeability = Uml::Changeability::AddOnly;

    // finished config, now unblock
    blockSignals(false);
    return true;
}
예제 #22
0
void frmCrearVale::on_txtImporte_editingFinished()
{
    blockSignals(true);
    ui->txtImporte->setText(Configuracion_global->toFormatoMoneda(ui->txtImporte->text()));
    blockSignals(false);
}
예제 #23
0
void QgsUnitSelectionWidget::setUnit( int unitIndex )
{
  blockSignals( true );
  mUnitCombo->setCurrentIndex( unitIndex );
  blockSignals( false );
}
예제 #24
0
파일: Qtfe.cpp 프로젝트: theShmoo/medvis2
void Qtfe::load()
{
	QString name = QFileDialog::getOpenFileName(0, QString(), QString(), "*.xml");
	if(name.isEmpty())
		return;
	filename = name;
	fileLabel->setText(filename);
	QFile file(filename);
	if (!file.open(QIODevice::ReadOnly))
		return;

	QDomDocument doc;
	if (!doc.setContent(&file))
	{
		file.close();
		return;
	}
	file.close();

	// block functionChanged() signal while loading
	blockSignals(true);

	for(int i=0 ; i < canals.size() ; ++i)
		delete canals[i];
	for(int i=0 ; i < outputs.size() ; ++i)
		delete outputs[i];

	canals.clear();
	outputs.clear();

	QDomElement root = doc.documentElement();
	QDomNode node = root.firstChild();

	while(!node.isNull())
	{
		QDomElement element = node.toElement();
		if (element.tagName() == "Function")
		{
			addCanal(1, "Red");
			QtfeCanal * canal = canals.back();
			QDomNodeList points = element.childNodes();
			canal->setFirstPoint(points.item(0).toElement().attributeNode("y").value().toDouble());
			canal->setLastPoint(points.item(points.length()-1).toElement().attributeNode("y").value().toDouble());

			for(int i=1;i<points.length()-1;i++)
			{
				QDomNode point = points.item(i);

				qreal x = point.toElement().attributeNode("x").value().toDouble();
				qreal y = point.toElement().attributeNode("y").value().toDouble();
		
				canal->insertPoint(QPointF(x,y));
			}
		}
		if (element.tagName() == "Output")
		{
			QtfeOutput * output = new QtfeOutput(this);
			output->bindCanaltoR(element.attributeNode("R").value().toInt());	
			output->bindCanaltoG(element.attributeNode("G").value().toInt());
			output->bindCanaltoB(element.attributeNode("B").value().toInt());
			output->bindCanaltoA(element.attributeNode("A").value().toInt());
			outputs.push_back(output);
			this->layout()->addWidget(output);
		}

		node = node.nextSibling();
	}

	// unblock functionChanged() signal and emit
	blockSignals(false);
	emit functionChanged();
}
예제 #25
0
void
MidiMixerWindow::slotUpdateInstrument(InstrumentId id)
{
    //RG_DEBUG << "MidiMixerWindow::slotUpdateInstrument - id = " << id << endl;

    DeviceListConstIterator it;
    MidiDevice *dev = 0;
    InstrumentList instruments;
    InstrumentList::const_iterator iIt;
    int count = 0;

    blockSignals(true);

    for (it = m_studio->begin(); it != m_studio->end(); ++it) {
        dev = dynamic_cast<MidiDevice*>(*it);

        if (dev) {
            instruments = dev->getPresentationInstruments();
            ControlList controls = getIPBForMidiMixer(dev);

            for (iIt = instruments.begin(); iIt != instruments.end(); ++iIt) {
                // Match and set
                //
                if ((*iIt)->getId() == id) {
                    // Set Volume fader
                    //
                    m_faders[count]->m_volumeFader->blockSignals(true);

                    MidiByte volumeValue;
                    try {
                        volumeValue = (*iIt)->
                                getControllerValue(MIDI_CONTROLLER_VOLUME);
                    } catch (std::string s) {
                        // This should never get called.
                        volumeValue = (*iIt)->getVolume();
                    }
                    
                    m_faders[count]->m_volumeFader->setFader(float(volumeValue));
                    m_faders[count]->m_volumeFader->blockSignals(false);

                    /*
                    StaticControllers &staticControls = 
                        (*iIt)->getStaticControllers();
                    RG_DEBUG << "STATIC CONTROLS SIZE = " 
                             << staticControls.size() << endl;
                    */

                    // Set all controllers for this Instrument
                    //
                    for (size_t i = 0; i < controls.size(); ++i) {
                        float value = 0.0;

                        m_faders[count]->m_controllerRotaries[i].second->blockSignals(true);

                        // The ControllerValues might not yet be set on
                        // the actual Instrument so don't always expect
                        // to find one.  There might be a hole here for
                        // deleted Controllers to hang around on
                        // Instruments..
                        //
                        try {
                            value = float((*iIt)->getControllerValue
                                          (controls[i].getControllerValue()));
                        } catch (std::string s) {
                            /*
                            RG_DEBUG << 
                            "MidiMixerWindow::slotUpdateInstrument - "
                                     << "can't match controller " 
                                     << int(controls[i].
                                         getControllerValue()) << " - \""
                                     << s << "\"" << endl;
                                     */
                            continue;
                        }

                        /*
                        RG_DEBUG << "MidiMixerWindow::slotUpdateInstrument"
                                 << " - MATCHED "
                                 << int(controls[i].getControllerValue())
                                 << endl;
                                 */

                        m_faders[count]->m_controllerRotaries[i].
                        second->setPosition(value);

                        m_faders[count]->m_controllerRotaries[i].second->blockSignals(false);
                    }
                }
                count++;
            }
        }
    }

    blockSignals(false);
}
예제 #26
0
파일: cmykfw.cpp 프로젝트: gyuris/scribus
void CMYKChoose::setColor()
{
	int c, m, y;
	int h, s, v;
	int k = 0;
	double L, a, b;
	ScColor tmp;
	if (Farbe.getColorModel() == colorModelCMYK)
	{
		c = qRound(CyanSp->value() * 2.55);
		m = qRound(MagentaSp->value() * 2.55);
		y = qRound(YellowSp->value() * 2.55);
		k = qRound(BlackSp->value() * 2.55);
		tmp.setColor(c, m, y, k);
		Farbe = tmp;
		if (dynamic)
		{
			CyanSL->setPalette(sliderPix(180));
			MagentaSL->setPalette(sliderPix(300));
			YellowSL->setPalette(sliderPix(60));
			BlackSL->setPalette(sliderBlack());
		}
		BlackComp = k;
		ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
		ColorMap->drawPalette(v);
		ColorMap->setMark(h, s);
	}
	else if (Farbe.getColorModel() == colorModelRGB)
	{
		c = qRound(CyanSp->value());
		m = qRound(MagentaSp->value());
		y = qRound(YellowSp->value());
		k = qRound(BlackSp->value());
		if (Wsave)
		{
			blockSignals(true);
			c = c / 51 * 51;
			m = m / 51 * 51;
			y = y / 51 * 51;
			CyanSp->setValue(c);
			MagentaSp->setValue(m);
			YellowSp->setValue(y);
			CyanSL->setValue(c * 1000.0);
			MagentaSL->setValue(m * 1000.0);
			YellowSL->setValue(y * 1000.0);
			blockSignals(false);
		}
		tmp.setColorRGB(c, m, y);
		QColor tmp2 = QColor(c, m, y);
		tmp2.getHsv(&h, &s, &v);
		BlackComp = 255 - v;
		Farbe = tmp;
		if (dynamic)
		{
			CyanSL->setPalette(sliderPix(0));
			MagentaSL->setPalette(sliderPix(120));
			YellowSL->setPalette(sliderPix(240));
		}
		BlackComp = k;
		ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
		ColorMap->drawPalette(v);
		ColorMap->setMark(h, s);
	}
	else if (Farbe.getColorModel() == colorModelLab)
	{
		double Lalt;
		Farbe.getLab(&Lalt, &a, &b);
		if (isHLC)
		{
			L = MagentaSp->value();
			double cv = 360 - CyanSp->value();
			double yv = YellowSp->value();
			QLineF lin = QLineF::fromPolar(yv, cv);
			a = lin.p2().x();
			b = lin.p2().y();
		}
		else
		{
			L = CyanSp->value();
			a = MagentaSp->value();
			b = YellowSp->value();
		}
		tmp.setColor(L, a, b);
		Farbe = tmp;
		if (dynamic)
		{
			CyanSL->setPalette(sliderPix(0));
			MagentaSL->setPalette(sliderPix(120));
			YellowSL->setPalette(sliderPix(240));
		}
		BlackComp = qRound(L * 2.55);
		if (L != Lalt)
			ColorMap->drawPalette(L * 2.55);
		ColorMap->setMark(a, b);
	}
	imageN.fill(ScColorEngine::getDisplayColor(tmp, m_doc) );
	if ( ScColorEngine::isOutOfGamut(tmp, m_doc) )
		paintAlert(alertIcon, imageN, 2, 2, false);
	NewC->setPixmap( imageN );
}
예제 #27
0
//*******************************************************
//* Reset the tag editor to the default text
//*******************************************************
void TagEditorNewTag::resetText() {
    blockSignals(true);
    setText(defaultText);
    blockSignals(false);
}
예제 #28
0
void KPropertyDateTimeEditor::setValue(const QVariant& value)
{
    blockSignals(true);
    setDateTime(value.toDateTime());
    blockSignals(false);
}
예제 #29
0
void TagWidget::clear()
{
	blockSignals(true);
	GroupedLineEdit::clear();
	blockSignals(false);
}
예제 #30
0
void SpinBoxRangeSliderQt::setMinMaxRange(const int minRange, const int maxRange) {
    blockSignals(true);
    setMinRange(minRange);
    setMaxRange(maxRange);
    blockSignals(false);
}