예제 #1
0
파일: me.c 프로젝트: rforge/phyloc
void updateSizes(edge *e, int direction)
{
  edge *f;
  switch(direction)
    {
    case UP:
      f = e->head->leftEdge;
      if (NULL != f)
	updateSizes(f,UP);
      f = e->head->rightEdge;
      if (NULL != f)
	updateSizes(f,UP);
      e->topsize++;
      break;
    case DOWN:
      f = siblingEdge(e);
      if (NULL != f)
	updateSizes(f,UP);
      f = e->tail->parentEdge;
      if (NULL != f)
	updateSizes(f,DOWN);
      e->bottomsize++;
      break;
    }
}
예제 #2
0
void MenuItem::updateItem(){
  //Update the item visuals, based upon current device status
  if( isConnected() ){
    if( isMounted() ){
      if(mountpoint.isEmpty()){
      	//detect the current mountpoint
      	QString output = pcbsd::Utils::runShellCommandSearch("mount",device);
        mountpoint = output.section(" on ",1,1).section(" (",0,0).replace(" ","-");
      }
      devIcon->setEnabled(TRUE);  //Make the icon full color
      devIcon->setToolTip(device+"\n"+QString(tr("Mounted at %1")).arg(mountpoint));
      pushMount->setText(tr("Eject"));
      pushMount->setIcon(QIcon(":icons/eject.png"));
      if(devType != "ISO"){ checkAutomount->setVisible(TRUE); }
      else{ checkAutomount->setVisible(FALSE); }
    }else{	  
      devIcon->setEnabled(FALSE); //Grey out the icon if not mounted
      devIcon->setToolTip(device);
      pushMount->setText(tr("Mount"));
      pushMount->setIcon(QIcon(":icons/mount.png"));
      checkAutomount->setVisible(FALSE);
    }
  }else{
    emit itemRemoved(device);
    return;
  }
  //Set visibility and sizes on progressbar
  updateSizes();
}
예제 #3
0
void RsCollectionDialog::itemChanged(QTreeWidgetItem *item, int col)
{
	if (col != COLUMN_FILE) return;

	if (item->data(COLUMN_HASH, ROLE_TYPE).toUInt() != DIR_TYPE_FILE) return;

	//In COLUMN_FILE, normaly, only checkState could change...
	qulonglong size = item->data(COLUMN_SIZE, ROLE_SIZE).toULongLong();
	bool unchecked = (item->checkState(COLUMN_FILE) == Qt::Unchecked);
	item->setData(COLUMN_SIZE, ROLE_SELSIZE, unchecked?0:size);
	item->setText(COLUMN_SIZE, misc::friendlyUnit(unchecked?0:size));
	item->setData(COLUMN_FILEC, ROLE_SELFILEC, unchecked?0:1);
	item->setText(COLUMN_FILEC, QString("%1").arg(unchecked?0:1));

	//update parents size
	QTreeWidgetItem *itemParent = item->parent();
	while (itemParent) {
		//When unchecked only remove selected size
		qulonglong parentSize = itemParent->data(COLUMN_SIZE, ROLE_SELSIZE).toULongLong() + (unchecked?0-size:size);
		itemParent->setData(COLUMN_SIZE, ROLE_SELSIZE, parentSize);
		itemParent->setText(COLUMN_SIZE, misc::friendlyUnit(parentSize));

		qulonglong parentFileCount = itemParent->data(COLUMN_FILEC, ROLE_SELFILEC).toULongLong() + (unchecked?0-1:1);
		itemParent->setData(COLUMN_FILEC, ROLE_SELFILEC, parentFileCount);
		itemParent->setText(COLUMN_FILEC, QString("%1").arg(parentFileCount));

		itemParent = itemParent->parent();
	}//while (itemParent)

	updateSizes() ;

}
예제 #4
0
파일: cord.hpp 프로젝트: det/Twil
	void insert(
		BranchEntryT * First, BranchEntryT * Last,
		T const * Data, std::size_t DataSize,
		LeafEntryT & Entry)
	{
		auto Sum = Entry.Size + DataSize;

		// If we have room for the data in this leaf, we are done
		if (Sum <= BlockSize)
		{
			merge(Entry.Index, Entry.Pointer->Buffer, Entry.Size, Data, DataSize);
			updateSizes(First, Last, DataSize);
			Entry.Index += DataSize;
			Entry.Size += DataSize;
			return;
		}

		// No room, split into 2 and insert the first half in the parent
		auto LeftSize = Sum / 2;
		auto RightSize = Sum - LeftSize;
		auto Right = new LeafT;
		split(
			Entry.Index,
			LeftSize, RightSize, Right->Buffer,
			Entry.Pointer->Buffer, Entry.Size,
			Data, DataSize);
		insert(First, Last, DataSize, LeftSize, {RightSize, Right});
	}
예제 #5
0
	void TreeInspector::init(const Vector2 &size, spActor actor)
	{
		setSize(size);

		
		_rootPage = new TreeInspectorPage(this, 0);		
		//_rootPage->setTouchChildrenEnabled(false);
		//_rootPage->setTouchEnabled(false);

		
		_rootPage->init(actor);
		
		_rootPage->setY(5);
		setWidth(_rootPage->getWidth());

		
		spSlidingActor slidingActor = new SlidingActor();
		slidingActor->setSize(size);
		slidingActor->setContent(_rootPage);
		
		addChild(slidingActor);
		
		_sliding = slidingActor;
		

		TextStyle style;
		style.font = _resSystem->getResFont("system")->getFont();
		style.vAlign = TextStyle::VALIGN_TOP;

		updateSizes();
	}
예제 #6
0
RsCollectionDialog::RsCollectionDialog(const QString& CollectionFileName,const std::vector<RsCollectionFile::DLinfo>& dlinfos)
	: _dlinfos(dlinfos),_filename(CollectionFileName)
{
	setupUi(this) ;

	setWindowFlags(Qt::Window); // for maximize button
	setWindowFlags(windowFlags() & ~Qt::WindowMinimizeButtonHint);

	setWindowTitle(QString("%1 - %2").arg(windowTitle()).arg(QFileInfo(_filename).completeBaseName()));

	// 1 - add all elements to the list.

	_fileEntriesTW->setColumnCount(3) ;

	QTreeWidgetItem *headerItem = _fileEntriesTW->headerItem();
	headerItem->setText(0, tr("File"));
	headerItem->setText(1, tr("Size"));
	headerItem->setText(2, tr("Hash"));

	uint32_t size = dlinfos.size();

	uint64_t total_size ;
	uint32_t total_files ;

	for(uint32_t i=0;i<size;++i)
	{
		const RsCollectionFile::DLinfo &dlinfo = dlinfos[i];

		QTreeWidgetItem *item = new QTreeWidgetItem;

		item->setFlags(Qt::ItemIsUserCheckable | item->flags());
		item->setCheckState(0, Qt::Checked);
		item->setData(0, Qt::UserRole, i);
		item->setText(0, dlinfo.path + "/" + dlinfo.name);
		item->setText(1, misc::friendlyUnit(dlinfo.size));
		item->setText(2, dlinfo.hash);

		_fileEntriesTW->addTopLevelItem(item);

		total_size += dlinfo.size ;
		total_files++ ;
	}

	_filename_TL->setText(_filename) ;
	for (int column = 0; column < _fileEntriesTW->columnCount(); ++column) {
		_fileEntriesTW->resizeColumnToContents(column);
	}

	updateSizes() ;

	// 2 - connect necessary signals/slots

	connectUpdate(true);
	connect(_selectAll_PB,SIGNAL(clicked()),this,SLOT(selectAll())) ;
	connect(_deselectAll_PB,SIGNAL(clicked()),this,SLOT(deselectAll())) ;
	connect(_cancel_PB,SIGNAL(clicked()),this,SLOT(cancel())) ;
	connect(_download_PB,SIGNAL(clicked()),this,SLOT(download())) ;

	_fileEntriesTW->installEventFilter(this);
}
예제 #7
0
bool RsCollectionDialog::eventFilter(QObject *obj, QEvent *event)
{
	if (obj == _fileEntriesTW) {
		if (event->type() == QEvent::KeyPress) {
			QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
			if (keyEvent && keyEvent->key() == Qt::Key_Space) {
				// Space pressed

				// get state of current item
				QTreeWidgetItem *item = _fileEntriesTW->currentItem();
				if (item) {
					Qt::CheckState checkState = (item->checkState(0) == Qt::Checked) ? Qt::Unchecked : Qt::Checked;

					connectUpdate(false);

					// set state of all selected items
					QList<QTreeWidgetItem*> selectedItems = _fileEntriesTW->selectedItems();
					QList<QTreeWidgetItem*>::iterator it;
					for (it = selectedItems.begin(); it != selectedItems.end(); ++it) {
						(*it)->setCheckState(0, checkState);
					}

					updateSizes();

					connectUpdate(true);
				}

				return true; // eat event
			}
		}
	}
	// pass the event on to the parent class
	return QDialog::eventFilter(obj, event);
}
예제 #8
0
파일: NPT.cpp 프로젝트: xielm12/OpenMD
  NPT::NPT(SimInfo* info) :
    VelocityVerletIntegrator(info), etaTolerance(1e-6), chiTolerance(1e-6), 
    maxIterNum_(4) {

      Globals* simParams = info_->getSimParams();
    
      if (!simParams->getUseIntialExtendedSystemState()) {
        Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
        currSnapshot->setThermostat(make_pair(0.0, 0.0));
        currSnapshot->setBarostat(Mat3x3d(0.0));
      }
    
      if (!simParams->haveTargetTemp()) {
        sprintf(painCave.errMsg, "You can't use the NVT integrator without a targetTemp!\n");
        painCave.isFatal = 1;
        painCave.severity = OPENMD_ERROR;
        simError();
      } else {
        targetTemp = simParams->getTargetTemp();
      }

      // We must set tauThermostat
      if (!simParams->haveTauThermostat()) {
        sprintf(painCave.errMsg, "If you use the constant temperature\n"
		"\tintegrator, you must set tauThermostat.\n");

        painCave.severity = OPENMD_ERROR;
        painCave.isFatal = 1;
        simError();
      } else {
        tauThermostat = simParams->getTauThermostat();
      }

      if (!simParams->haveTargetPressure()) {
        sprintf(painCave.errMsg, "NPT error: You can't use the NPT integrator\n"
		"   without a targetPressure!\n");

        painCave.isFatal = 1;
        simError();
      } else {
        targetPressure = simParams->getTargetPressure();
      }
    
      if (!simParams->haveTauBarostat()) {
        sprintf(painCave.errMsg,
                "If you use the NPT integrator, you must set tauBarostat.\n");
        painCave.severity = OPENMD_ERROR;
        painCave.isFatal = 1;
        simError();
      } else {
        tauBarostat = simParams->getTauBarostat();
      }
    
      tt2 = tauThermostat * tauThermostat;
      tb2 = tauBarostat * tauBarostat;

      updateSizes();
    }
예제 #9
0
void PixmapDial::setEnabled(bool enabled)
{
    if (isEnabled() != enabled)
    {
        fPixmap.load(QString(":/bitmaps/dial_%1%2.png").arg(fPixmapNum).arg(enabled ? "" : "d"));
        updateSizes();
        update();
    }
    QDial::setEnabled(enabled);
}
예제 #10
0
void PixmapDial::setEnabled(bool enabled)
{
    if (isEnabled() != enabled)
    {
        m_pixmap.load(QString(":/dial_%1%2.png").arg(m_pixmap_n_str).arg(enabled ? "" : "d"));
        updateSizes();
        update();
    }
    QDial::setEnabled(enabled);
}
예제 #11
0
void QFontDialog::updateStyles()
{
    d->styleList->blockSignals( TRUE );

    d->styleList->clear();

    QStringList styles = d->fdb.styles( d->familyList->currentText() );

    if ( styles.isEmpty() ) {
	d->styleEdit->clear();
	d->smoothScalable = FALSE;
    } else {
	d->styleList->insertStringList( styles );

	if ( !d->style.isEmpty() ) {
	    bool found = FALSE;
	    bool first = TRUE;
	    QString cstyle = d->style;
	redo:
	    for ( int i = 0 ; i < (int)d->styleList->count() ; i++ ) {
		if ( cstyle == d->styleList->text(i) ) {
		    d->styleList->setCurrentItem( i );
		    found = TRUE;
		    break;
		}
	    }
	    if (!found && first) {
		if (cstyle.contains("Italic")) {
		    cstyle.replace("Italic", "Oblique");
		    first = FALSE;
		    goto redo;
		} else if (cstyle.contains("Oblique")) {
		    cstyle.replace("Oblique", "Italic");
		    first = FALSE;
		    goto redo;
		}
	    }
	    if ( !found )
		d->styleList->setCurrentItem( 0 );
	}

	d->styleEdit->setText( d->styleList->currentText() );
	if ( style().styleHint(QStyle::SH_FontDialog_SelectAssociatedText, this) &&
	     d->styleList->hasFocus() )
	    d->styleEdit->selectAll();

	d->smoothScalable = d->fdb.isSmoothlyScalable( d->familyList->currentText(), d->styleList->currentText() );
    }

    d->styleList->blockSignals( FALSE );

    updateSizes();
}
예제 #12
0
void QFontDialog::styleHighlighted( int index )
{
    QString s = d->styleList->text( index );
    d->styleEdit->setText( s );
    if ( style().styleHint(QStyle::SH_FontDialog_SelectAssociatedText, this) &&
	 d->styleList->hasFocus() )
	d->styleEdit->selectAll();

    d->style = s;

    updateSizes();
}
void ComparativeBarChart::update()
{
    updateSizes();

    osg::Vec3 scale(_width,1.0,_height);
    osg::Matrix scaleMat;
    scaleMat.makeScale(scale);
    _bgScaleMT->setMatrix(scaleMat);

    updateAxis();
    updateGraph();
}
예제 #14
0
void PixmapDial::setPixmap(int pixmapId)
{
    m_pixmap_n_str.sprintf("%02i", pixmapId);
    m_pixmap.load(QString(":/bitmaps/dial_%1%2.png").arg(m_pixmap_n_str).arg(isEnabled() ? "" : "d"));

    if (m_pixmap.width() > m_pixmap.height())
        m_orientation = HORIZONTAL;
    else
        m_orientation = VERTICAL;

    updateSizes();
    update();
}
예제 #15
0
파일: movegen.cpp 프로젝트: avilon/Athena
MoveGen::MoveGen(GameLaw *gl, Board *board, MoveList *moveList, QObject *parent) :
    QObject(parent)
{
    m_gameLaw = gl;
    m_board = board;
    m_moveList = moveList;

    connect(gl, SIGNAL(onChangeLaw()), this, SLOT(changeLaw()));
    connect(board, SIGNAL(onChangeSize(int,int)), this, SLOT(changeSize(int,int)));

    updateRules();
    updateSizes();
}
예제 #16
0
void PixmapDial::setPixmap(int pixmapId)
{
    fPixmapNum.sprintf("%02i", pixmapId);
    fPixmap.load(QString(":/bitmaps/dial_%1%2.png").arg(fPixmapNum).arg(isEnabled() ? "" : "d"));

    if (fPixmap.width() > fPixmap.height())
        fOrientation = HORIZONTAL;
    else
        fOrientation = VERTICAL;

    updateSizes();
    update();
}
예제 #17
0
void QFontDialogPrivate::_q_styleHighlighted(int index)
{
    Q_Q(QFontDialog);
    QString s = styleList->text(index);
    styleEdit->setText(s);
    if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
            && styleList->hasFocus())
        styleEdit->selectAll();

    style = s;

    updateSizes();
}
예제 #18
0
void
CQFontChooser::
updateWidgets()
{
  cedit_  ->setVisible(style_ == FontEdit  );
  cbutton_->setVisible(style_ == FontButton);
  clabel_ ->setVisible(style_ == FontLabel || style_ == FontDetailLabel);
  button_ ->setVisible(style_ != FontCombo );
  ncombo_ ->setVisible(style_ == FontCombo );
  scombo_ ->setVisible(style_ == FontCombo );
  zcombo_ ->setVisible(style_ == FontCombo );

  if (fixedWidth_)
    ncombo_->setFontFilters(QFontComboBox::MonospacedFonts);
  else
    ncombo_->setFontFilters(QFontComboBox::AllFonts);

  ncombo_->setWritingSystem(QFontDatabase::Latin);
//ncombo_->setCurrentIndex(1);

  cedit_->setText(fontName_);

  cbutton_->setFont(font_);
  cbutton_->setText(exampleText());

  clabel_->setFont(font_);

  if (style_ == FontDetailLabel) {
    QFontDatabase database;

    QString style = database.styleString(font_);

    clabel_->setText(QString("%1, %2, %3").
      arg(font_.substitute(font_.family())).arg(style).arg(font_.pointSize()));
  }
  else
    clabel_->setText(exampleText());

  int nind = ncombo_->findText(font_.family());

  if (nind >= 0)
    ncombo_->setCurrentIndex(nind);

  updateStyles();
  updateSizes ();

  updateCombos();

  layout()->invalidate();
}
예제 #19
0
/*
    Updates the contents of the "font style" list box. This
    function can be reimplemented if you have special requirements.
*/
void QFontDialogPrivate::updateStyles()
{
    Q_Q(QFontDialog);
    QStringList styles = fdb.styles(familyList->currentText());
    styleList->model()->setStringList(styles);

    if (styles.isEmpty()) {
        styleEdit->clear();
        smoothScalable = false;
    } else {
        if (!style.isEmpty()) {
            bool found = false;
            bool first = true;
            QString cstyle = style;

redo:
            for (int i = 0; i < (int)styleList->count(); i++) {
                if (cstyle == styleList->text(i)) {
                    styleList->setCurrentItem(i);
                    found = true;
                    break;
                }
            }
            if (!found && first) {
                if (cstyle.contains(QLatin1String("Italic"))) {
                    cstyle.replace(QLatin1String("Italic"), QLatin1String("Oblique"));
                    first = false;
                    goto redo;
                } else if (cstyle.contains(QLatin1String("Oblique"))) {
                    cstyle.replace(QLatin1String("Oblique"), QLatin1String("Italic"));
                    first = false;
                    goto redo;
                }
            }
            if (!found)
                styleList->setCurrentItem(0);
        } else {
            styleList->setCurrentItem(0);
        }

        styleEdit->setText(styleList->currentText());
        if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
                && styleList->hasFocus())
            styleEdit->selectAll();

        smoothScalable = fdb.isSmoothlyScalable(familyList->currentText(), styleList->currentText());
    }

    updateSizes();
}
예제 #20
0
void LayoutTextTrackContainer::layout() {
  LayoutBlockFlow::layout();
  if (style()->display() == EDisplay::None)
    return;

  DeprecatedScheduleStyleRecalcDuringLayout marker(
      node()->document().lifecycle());

  LayoutObject* mediaLayoutObject = parent();
  if (!mediaLayoutObject || !mediaLayoutObject->isVideo())
    return;
  if (updateSizes(toLayoutVideo(*mediaLayoutObject)))
    toElement(node())->setInlineStyleProperty(
        CSSPropertyFontSize, m_fontSize, CSSPrimitiveValue::UnitType::Pixels);
}
예제 #21
0
/**
 * @brief RsCollectionDialog::updateList: Update list of item in RsCollection
 * @return If at least one item have a Wrong Char
 */
bool RsCollectionDialog::updateList()
{
	bool wrong_chars = false ;
	wrong_chars = addChild(getRootItem(), _newColFileInfos);

	_newColFileInfos.clear();

	ui._filename_TL->setText(_fileName) ;
	for (int column = 0; column < ui._fileEntriesTW->columnCount(); ++column) {
		ui._fileEntriesTW->resizeColumnToContents(column);
	}

	updateSizes() ;

	return !wrong_chars;
}
예제 #22
0
        void CEntity::setMesh(scene::IAnimatedMesh* mesh) {
            if (Node) {
                Node->drop();
                Node->remove();
                Node = 0;
            }

            Box.reset(core::vector3df());

            if (mesh) {
                Node = getSceneManager()->addAnimatedMeshSceneNode(mesh, this);
                Node->grab();
                
                Box.addInternalBox(mesh->getBoundingBox());
                updateSizes();
            }
        }
예제 #23
0
LRESULT HashingPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// Do specialized reading here
	PropPage::read((HWND)*this, items);
	PropPage::translate((HWND)(*this), texts);

	//hashing
	setMinMax(IDC_HASH_SPIN, 0, 9999);
	setMinMax(IDC_VOL_HASHERS_SPIN, 1, 30);
	setMinMax(IDC_HASHING_THREADS_SPIN, 1, 50);

	CheckDlgButton(IDC_REPAIR_HASHDB, HashManager::getInstance()->isRepairScheduled());
	updateSizes();
	fixControls();

	return TRUE;
}
예제 #24
0
파일: cord.hpp 프로젝트: det/Twil
	void insert(
		BranchEntryT * First, BranchEntryT * Last,
		std::size_t DataSize, std::size_t LeftSize,
		NodeT RightNode)
	{
		while (First != Last)
		{
			auto & Entry = *First++;
			auto BranchLength = getLength(Entry.Pointer, Entry.Size);
			auto Sum = BranchLength + 1;
			Entry.Pointer->Children[Entry.Index].Size = LeftSize;

			// If we have room for the child we are done
			if (Sum <= Order)
			{
				merge(Entry.Index + 1, Entry.Pointer->Children, BranchLength, &RightNode, 1);
				updateSizes(First, Last, DataSize);
				return;
			}

			// No room, split into 2 and insert the first half in the parent
			auto LeftLength = Sum / 2;
			auto RightLength = Sum - LeftLength;
			auto Right = new BranchT;
			split(
				Entry.Index + 1,
				LeftLength, RightLength, Right->Children,
				Entry.Pointer->Children, BranchLength,
				&RightNode, 1);
			std::size_t RightSize = 0;
			for (std::size_t I = 0; I != RightLength; ++I) RightSize += Right->Children[I].Size;
			RightNode = {RightSize, Right};
			LeftSize = Entry.Size + DataSize - RightSize;
		}

		// We have reached the root, grow upward
		auto Branch = new BranchT;
		Branch->Children[0].Pointer = mRoot.Pointer;
		Branch->Children[0].Size = LeftSize;
		Branch->Children[1] = RightNode;
		mRoot.Pointer = Branch;
		mRoot.Size = LeftSize + RightNode.Size;
		mHeight++;
	}
예제 #25
0
void LayerDialog::setMultiLayer(MultiLayer *g)
{
	if (!g)
		return;

	multi_layer = g;

	layersBox->setValue(g->numLayers());
	boxX->setValue(g->getCols());
	boxY->setValue(g->getRows());

	linkXAxesBox->setChecked(g->hasLinkedXLayerAxes());

	alignPolicyBox->setCurrentIndex(g->alignPolicy());
	boxColsGap->setValue(g->colsSpacing());
	boxRowsGap->setValue(g->rowsSpacing());
	boxLeftSpace->setValue(g->leftMargin());
	boxRightSpace->setValue(g->rightMargin());
	boxTopSpace->setValue(g->topMargin());
	boxBottomSpace->setValue(g->bottomMargin());

	FrameWidget::Unit unit = (FrameWidget::Unit)g->applicationWindow()->d_layer_geometry_unit;
	unitBox->blockSignals(true);
	unitBox->setCurrentIndex(unit);
	unitBox->blockSignals(false);

	updateSizes(unit);

	GroupCanvasSize->setChecked(g->sizePolicy() == MultiLayer::UserSize);

	fixedSizeBox->setChecked(!g->scaleLayersOnResize());

	alignHorBox->setCurrentItem(g->horizontalAlignement());
	alignVertBox->setCurrentItem(g->verticalAlignement());

	boxLayerSrc->setRange(1, g->numLayers());
	boxLayerDest->setRange(1, g->numLayers());
	boxLayerDest->setValue(g->numLayers());

	showCommonAxesBox();
}
예제 #26
0
PixmapDial::PixmapDial(QWidget* parent)
    : QDial(parent)
{
    m_pixmap.load(":/bitmaps/dial_01d.png");
    m_pixmap_n_str = "01";
    m_custom_paint = CUSTOM_PAINT_NULL;

    m_hovered    = false;
    m_hover_step = HOVER_MIN;

    if (m_pixmap.width() > m_pixmap.height())
        m_orientation = HORIZONTAL;
    else
        m_orientation = VERTICAL;

    m_label = "";
    m_label_pos = QPointF(0.0f, 0.0f);
    m_label_width  = 0;
    m_label_height = 0;
    m_label_gradient = QLinearGradient(0, 0, 0, 1);

    if (palette().window().color().lightness() > 100)
    {
        // Light background
        QColor c = palette().dark().color();
        m_color1 = c;
        m_color2 = QColor(c.red(), c.green(), c.blue(), 0);
        m_colorT[0] = palette().buttonText().color();
        m_colorT[1] = palette().mid().color();
    }
    else
    {
        // Dark background
        m_color1 = QColor(0, 0, 0, 255);
        m_color2 = QColor(0, 0, 0, 0);
        m_colorT[0] = Qt::white;
        m_colorT[1] = Qt::darkGray;
    }

    updateSizes();
}
예제 #27
0
void backgroundMesh2D::reset(bool erase_2D3D)
{
    unset();

    // create face mesh - this was previously done for old backgroundmesh in buildBackGroundMesh !
    create_face_mesh();

    // computes the mesh sizes at nodes
    if (CTX::instance()->mesh.lcFromPoints) {
        computeSizeField();
    }
    else
        for (std::map<MVertex*, MVertex*>::iterator itv2 = _2Dto3D.begin() ; itv2 != _2Dto3D.end(); ++itv2)
            sizeField[itv2->first] = CTX::instance()->mesh.lcMax;

    // ensure that other criteria are fullfilled
    updateSizes();

    if (erase_2D3D) {
        _3Dto2D.clear();
        _2Dto3D.clear();
    }
}
예제 #28
0
PixmapDial::PixmapDial(QWidget* parent)
    : QDial(parent),
      fPixmap(":/bitmaps/dial_01d.png"),
      fPixmapNum("01"),
      fCustomPaint(CUSTOM_PAINT_NULL),
      fOrientation(fPixmap.width() > fPixmap.height() ? HORIZONTAL : VERTICAL),
      fHovered(false),
      fHoverStep(HOVER_MIN),
      fLabel(""),
      fLabelPos(0.0f, 0.0f),
      fLabelWidth(0),
      fLabelHeight(0),
      fLabelGradient(0, 0, 0, 1)
{
    fLabelFont.setPointSize(6);

    if (palette().window().color().lightness() > 100)
    {
        // Light background
        const QColor c(palette().dark().color());
        fColor1    = c;
        fColor2    = QColor(c.red(), c.green(), c.blue(), 0);
        fColorT[0] = palette().buttonText().color();
        fColorT[1] = palette().mid().color();
    }
    else
    {
        // Dark background
        fColor1    = QColor(0, 0, 0, 255);
        fColor2    = QColor(0, 0, 0, 0);
        fColorT[0] = Qt::white;
        fColorT[1] = Qt::darkGray;
    }

    updateSizes();
}
예제 #29
0
void PixmapDial::resizeEvent(QResizeEvent* event)
{
    updateSizes();
    QDial::resizeEvent(event);
}
예제 #30
0
RsCollectionDialog::RsCollectionDialog(const QString& CollectionFileName,const std::vector<RsCollectionFile::DLinfo>& dlinfos)
	: _dlinfos(dlinfos),_filename(CollectionFileName)
{
	setupUi(this) ;

	setWindowFlags(Qt::Window); // for maximize button
	setWindowFlags(windowFlags() & ~Qt::WindowMinimizeButtonHint);

	setWindowTitle(QString("%1 - %2").arg(windowTitle()).arg(QFileInfo(_filename).completeBaseName()));

	// 1 - add all elements to the list.

	_fileEntriesTW->setColumnCount(3) ;

	QTreeWidgetItem *headerItem = _fileEntriesTW->headerItem();
	headerItem->setText(0, tr("File"));
	headerItem->setText(1, tr("Size"));
	headerItem->setText(2, tr("Hash"));

	uint32_t size = dlinfos.size();

	uint64_t total_size ;
	uint32_t total_files ;
	bool wrong_chars = false ;

	for(uint32_t i=0;i<size;++i)
	{
		const RsCollectionFile::DLinfo &dlinfo = dlinfos[i];

		QTreeWidgetItem *item = new QTreeWidgetItem;

		item->setFlags(Qt::ItemIsUserCheckable | item->flags());
		item->setCheckState(0, Qt::Checked);
		item->setData(0, Qt::UserRole, i);
		item->setText(0, dlinfo.path + "/" + dlinfo.name);
		item->setText(1, misc::friendlyUnit(dlinfo.size));
		item->setText(2, dlinfo.hash);

		if(dlinfo.filename_has_wrong_characters)
		{
			wrong_chars = true ;
			item->setTextColor(0,QColor(255,80,120)) ;
		}

		_fileEntriesTW->addTopLevelItem(item);

		total_size += dlinfo.size ;
		total_files++ ;
	}

	_filename_TL->setText(_filename) ;
	for (int column = 0; column < _fileEntriesTW->columnCount(); ++column) {
		_fileEntriesTW->resizeColumnToContents(column);
	}

	updateSizes() ;

	// 2 - connect necessary signals/slots

	connectUpdate(true);
	connect(_selectAll_PB,SIGNAL(clicked()),this,SLOT(selectAll())) ;
	connect(_deselectAll_PB,SIGNAL(clicked()),this,SLOT(deselectAll())) ;
	connect(_cancel_PB,SIGNAL(clicked()),this,SLOT(cancel())) ;
	connect(_download_PB,SIGNAL(clicked()),this,SLOT(download())) ;

	_fileEntriesTW->installEventFilter(this);

	if(wrong_chars)
		QMessageBox::warning(NULL,tr("Bad filenames have been cleaned"),tr("Some filenames or directory names contained forbidden characters.\nCharacters <b>\",|,/,\\,&lt;,&gt;,*,?</b> will be replaced by '_'.\n Concerned files are listed in red.")) ;
}