// Channel display background effect.
void ChannelStrip::setDisplayEffect ( bool bDisplayEffect )
{
	QPalette pal;
	pal.setColor(QPalette::Foreground, Qt::yellow);
	pal.setColor(QPalette::ButtonText, Qt::yellow);
	m_ui.EngineNameTextLabel->setPalette(pal);
	m_ui.MidiPortChannelTextLabel->setPalette(pal);
	pal.setColor(QPalette::Foreground, Qt::green);
	pal.setColor(QPalette::ButtonText, Qt::green);
	if (bDisplayEffect) {
		QPixmap pm(":/images/displaybg1.png");
		pal.setBrush(QPalette::Background, QBrush(pm));
	} else {
		pal.setColor(QPalette::Background, Qt::black);
	}
	m_ui.ChannelInfoFrame->setPalette(pal);
	m_ui.InstrumentNamePushButton->setPalette(pal);
	m_ui.StreamVoiceCountTextLabel->setPalette(pal);
}
Example #2
0
    /*static*/
    void MongoFile::closeAllFiles( stringstream &message ) {
        static int closingAllFiles = 0;
        if ( closingAllFiles ) {
            message << "warning closingAllFiles=" << closingAllFiles << endl;
            return;
        }
        ++closingAllFiles;

        LockMongoFilesExclusive lk;

        ProgressMeter pm( mmfiles.size() , 2 , 1 );
        set<MongoFile*> temp = mmfiles;
        for ( set<MongoFile*>::iterator i = temp.begin(); i != temp.end(); i++ ) {
            (*i)->close(); // close() now removes from mmfiles
            pm.hit();
        }
        message << "closeAllFiles() finished";
        --closingAllFiles;
    }
tp_obj zzpy__pyDFMenu_get(tp_vm *vm)
{
  tp_obj self = tp_getraw(vm);
  IScriptEngine *engine = (IScriptEngine*)tp_get(vm, vm->builtins, tp_string("userdata")).data.val;
  IEditor *editor = engine->editor();
  TinyParams pm(vm);
  ADM_scriptDFMenuHelper *me=(ADM_scriptDFMenuHelper *)pm.asThis(&self, ADM_PYID_DF_INTEGER);
  char const *key = pm.asString();
  if (!strcmp(key, "index"))
  {
     if(!me) pm.raise("pyDFMenu:No this!");
     return tp_number(me->index());
  }
  if (!strcmp(key, "addItem"))
  {
     return tp_method(vm, self, zzpy_addItem);
  }
  return tp_get(vm, self, tp_string(key));
}
Example #4
0
void LightboxWidget::print()
{
  QString fn = QFileDialog::getSaveFileName("screenshot.png", 
					    "PNG files (*.png)", this,
					    "Screenshot dialog",
					    "Select a filename for saving");
  if(!fn.isNull()) 
    {
      QPixmap pm(centralWidget()->size());
      bitBlt(&pm, 0, 0, centralWidget());

//       QImage im = pm.convertToImage();
//       int dpm( (72.0 / 2.54) * 100.0 );
//       im.setDotsPerMeterX(dpm);
//       im.setDotsPerMeterY(dpm);
      pm.save(fn, "PNG", 100);
    }

}
Example #5
0
void framr_notify(actor_t *actor, message_t *message)
{
    int size;

    framr_t *self;
    struct core_vector *spawners;

    self = thorium_actor_concrete_actor(actor);

    spawners = &self->spawners;
    size = core_vector_size(spawners);

    pm("Boss received NOTIFY\n");

    ++self->completed;
    if (self->completed == size) {
        thorium_actor_send_range_empty(actor, spawners, ACTION_ASK_TO_STOP);
    }
}
	ProperClassMethods::ProperClassMethods(shared_ptr<Class> const &clazz)
	{
		for(std::size_t m=0;m<clazz->get_methods_count();++m)
		{
			proper_method pm(clazz->get_method(m));
			if(!m_methods.push_back(pm).second)
			{
				std::size_t n(1);
				do
				{
					format fmtName("%1%_%2%");
					fmtName % clazz->get_method(m)->get_name();
					fmtName % n++;
					pm.m_proper_name=fmtName.str();
				}
				while(!m_methods.push_back(pm).second);
			}
		}
	}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int QFilterParametersWriter::WritePipelineToFile(FilterPipeline::Pointer pipeline, const QString& filePath, const QString& name, QSettings::Format format, IObserver* obs)
{

  if(NULL == pipeline.get())
  {
    if(NULL != obs)
    {
      PipelineMessage pm(QFilterParametersWriter::ClassName(), "FilterPipeline Object was NULL for writing", -1, PipelineMessage::Error);
      obs->processPipelineMessage(pm);
    }
    return -1;
  }

  FilterPipeline::FilterContainerType& filters = pipeline->getFilterContainer();

  QFilterParametersWriter::Pointer writer = QFilterParametersWriter::New();
  // This will open the file, and write/update the initial group of settings like the name and DREAM3D Version
  writer->openFile(filePath, format);
  // Loop over each filter and write it's input parameters to the file
  int count = filters.size();
  int index = 0;
  for(qint32 i = 0; i < count; ++i)
  {
    AbstractFilter::Pointer filter = filters.at(i);
    if(NULL != filter.get())
    {
      index = filter->writeFilterParameters(writer.get(), index);
    }
    else
    {
      AbstractFilter::Pointer badFilter = AbstractFilter::New();
      writer->openFilterGroup(badFilter.get(), i);
      writer->writeValue("Unkown Filter", "ERROR: Filter instance was NULL within the PipelineFilterWidget instance. Report this error to the DREAM3D Developers");
      writer->closeFilterGroup();
    }
  }

  writer->setNumberOfFilters(index);
  writer->setPipelineName(name);
  writer->closeFile(); // Close the file
  return 0;
}
Example #8
0
void ComputeMgr::updateLocalComputes()
{
    ComputeMap *computeMap = ComputeMap::Object();
    CProxy_ProxyMgr pm(CkpvAccess(BOCclass_group).proxyMgr);
    ProxyMgr *proxyMgr = pm.ckLocalBranch();
    LdbCoordinator *ldbCoordinator = LdbCoordinator::Object();

     computeFlag.resize(0);

    const int nc = computeMap->numComputes();
    for (int i=0; i<nc; i++) {

        if ( computeMap->node(i) == CkMyPe() &&
             computeMap->newNumPartitions(i) > 1 ) {
           Compute *c = computeMap->compute(i);
           ldbCoordinator->Migrate(c->ldObjHandle,CkMyPe());
           delete c;
           computeMap->registerCompute(i,NULL);
           if ( computeMap->newNode(i) == CkMyPe() ) computeFlag.add(i); 
        } else
        if (computeMap->newNode(i) == CkMyPe() && computeMap->node(i) != CkMyPe())
        {
	    computeFlag.add(i);
            for (int n=0; n < computeMap->numPids(i); n++)
            {
                proxyMgr->createProxy(computeMap->pid(i,n));
            }
        }
        else if (computeMap->node(i) == CkMyPe() &&
                 (computeMap->newNode(i) != -1 && computeMap->newNode(i) != CkMyPe() ))
        {
            // CkPrintf("delete compute %d on pe %d\n",i,CkMyPe());
            delete computeMap->compute(i);
            computeMap->registerCompute(i,NULL);
        }
    }

    if (!CkMyPe())
    {
        CkStartQD(CkIndex_ComputeMgr::updateLocalComputes2((CkQdMsg*)0), &thishandle);
    }
}
Example #9
0
void Board::paintEvent(QPaintEvent *e)
{

	QRect ur = e->rect();            // rectangle to update
	QPixmap pm(ur.size());           // Pixmap for double-buffering
	pm.fill(this, ur.topLeft());     // fill with widget background
	QPainter p(&pm);
	p.translate(-ur.x(), -ur.y());   // use widget coordinate system

	if(paused)
	{
		p.setFont(KGlobalSettings::largeFont());
		p.drawText(rect(), Qt::AlignCenter, i18n("Game Paused"));
	}
	else
	{
		int w = tiles.tileWidth();
		int h = tiles.tileHeight();
		for(int i = 0; i < x_tiles(); i++)
		{
			for(int j = 0; j < y_tiles(); j++)
			{
				int tile = getField(i, j);
				if(tile == EMPTY)
					continue;

				int xpos = xOffset() + i * w;
				int ypos = yOffset() + j * h;
				QRect r(xpos, ypos, w, h);
				if(e->rect().intersects(r))
				{
					if(isTileHighlighted(i, j))
						p.drawPixmap(xpos, ypos, tiles.highlightedTile(tile-1));
					else
						p.drawPixmap(xpos, ypos, tiles.tile(tile-1));
				}
			}
		}
	}
	p.end();
	bitBlt( this, ur.topLeft(), &pm );
}
Example #10
0
TEST(UnitsTest, UnitsPair) {
    // Test basic construction via multiplication
    using grams = units::grams<float>;
    using yards = units::yards<float>;
    auto gy = grams{5} * yards{3};
    EXPECT_FLOAT_EQ(15.f, gy.amount());

    // Test basic construction via division
    using stones = units::stones<float>;
    using inches = units::inches<float>;
    auto si = stones{10} / inches{2};
    EXPECT_FLOAT_EQ(5.f, si.amount());

    // Test manual conversion
    using pounds = units::pounds<float>;
    using meters = units::meters<float>;
    using poundmeters = units::units_pair<pounds, meters>;
    poundmeters pm(grams{5}, yards{3});
    EXPECT_FLOAT_EQ(0.0302386280, pm.amount());
}
Example #11
0
bool BaseFileManager::hasFile(const Common::String &filename) {
	if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) {
		BasePersistenceManager pm(BaseEngine::instance().getGameId());
		if (filename.size() <= 9) {
			return false;
		}
		int slot = atoi(filename.c_str() + 9);
		return pm.getSaveExists(slot);
	}
	if (diskFileExists(filename)) {
		return true;
	}
	if (_packages.hasFile(filename)) {
		return true;    // We don't bother checking if the file can actually be opened, something bigger is wrong if that is the case.
	}
	if (BaseResources::hasFile(filename)) {
		return true;
	}
	return false;
}
Example #12
0
	ublas::matrix<double> invert(ublas::matrix<double> input) {
	 	typedef ublas::permutation_matrix<std::size_t> pmatrix;

	 	ublas::matrix<double> tmp(input);
	 	ublas::permutation_matrix<std::size_t> pm(tmp.size1());

	 	int res = ublas::lu_factorize(tmp,pm);

		if (res == 0) {
			ublas::matrix<double> inverse = ublas::identity_matrix<double>(tmp.size1());

			ublas::lu_substitute(tmp, pm, inverse);

			return inverse;
		} else {
			// Easy check for singularity, as nothing inverted = 0.
			// In the future, exceptions would be more prudent.
			return ublas::zero_matrix<double>(1, 1);
		}
	}
Example #13
0
QSObject QSPixmapClass::construct( const QSList &args ) const
{
    if ( args.size() > 0 ) {
	QSObject v( args[ 0 ] );
	if ( v.isA( "Pixmap" ) ) {
	    return v;
	} else if ( v.isString() ) {
	    QPixmap pm( v.toString() );
	    return construct( pm );
        } else {
            QVariant var = v.toVariant(QVariant::ByteArray);
            if (var.type() == QVariant::ByteArray) {
                QPixmap pm;
                pm.loadFromData( v.toVariant(QVariant::ByteArray).toByteArray() );
                return construct( pm );
            }
        }
    }
    return construct( QPixmap() );
}
Example #14
0
void WorkPlaceWidget::paintEvent(QPaintEvent *){
        QPainter painter(this);
        QRect r2(0,0,this->size().width()-1,this->size().height()-1);
        QPixmap pm(":Images/Map.png");
        painter.drawPixmap(0,0,this->size().width()-1,this->size().height()-1,pm);
        painter.drawRect(r2);
        if(this->curX<10){
            this->curX=10;
        }
        if(this->curY<10){
            this->curY=10;
        }
        if(this->curX>max_width-10){
            this->curX=max_width-10;
        }
        if(this->curY>max_height-10){
            this->curY=max_height-10;
        }
        this->paintDesk();
}
Example #15
0
void KexiDBImageBox::updatePixmap()
{
    if (!(designMode() && pixmap().isNull()))
        return;

    if (!KexiDBImageBox_static->pixmap) {
        const QString fname(KStandardDirs::locate("data", QLatin1String("kexi/pics/imagebox.png")));
        QPixmap pm( KIconLoader::global()->loadMimeTypeIcon(
            koIconNameCStr("image-x-generic"), KIconLoader::NoGroup, KIconLoader::SizeLarge, KIconLoader::DisabledState) );
        if (!pm.isNull()) {
            KIconEffect::semiTransparent(pm);
            KIconEffect::semiTransparent(pm);
        }
        KexiDBImageBox_static->pixmap = new QPixmap(pm);
        KexiDBImageBox_static->small = new QPixmap( 
            KexiDBImageBox_static->pixmap->scaled(
                KexiDBImageBox_static->pixmap->width() / 2, KexiDBImageBox_static->pixmap->height() / 2, 
                Qt::KeepAspectRatio, Qt::SmoothTransformation) );
    }
}
Example #16
0
QImage Score::createThumbnail()
{
    Page* page = pages().at(0);
    QRectF fr  = page->abbox();
    qreal mag  = 256.0 / qMax(fr.width(), fr.height());
    int w      = int(fr.width() * mag);
    int h      = int(fr.height() * mag);

    QImage pm(w, h, QImage::Format_ARGB32_Premultiplied);
    pm.setDotsPerMeterX(lrint((mag * 1000) / INCH));
    pm.setDotsPerMeterY(lrint((mag * 1000) / INCH));
    pm.fill(0xffffffff);
    QPainter p(&pm);
    p.setRenderHint(QPainter::Antialiasing, true);
    p.setRenderHint(QPainter::TextAntialiasing, true);
    p.scale(mag, mag);
    print(&p, 0);
    p.end();
    return pm;
}
Example #17
0
void DockContainer::popupMenu(QPoint p)
{
    int r;
    {
        KPopupMenu pm(this);
        pm.insertItem( i18n("Kill This Applet"), 0);
        pm.insertItem( i18n("Change Command"), 1);
        r = pm.exec(p);
        /* pm is destroyed now .. if it is destroyed later,
           there is a risk that kill() double-frees it */
    }
    switch (r) {
        case 0: {
            kill();
        } break;
        case 1: {
            askNewCommand(false);
        } break;
    }
}
Example #18
0
QVariant SensorModel::data( const QModelIndex &index, int role ) const
{
  if ( !index.isValid() )
    return QVariant();

  if ( index.row() >= mSensors.count() || index.row() < 0 )
    return QVariant();

  SensorModelEntry sensor = mSensors[ index.row() ];

  if ( role == Qt::DisplayRole ) {
    switch ( index.column() ) {
      case 0:
        return sensor.hostName();
        break;
      case 1:
        return sensor.sensorName();
        break;
      case 2:
        return sensor.unit();
        break;
      case 3:
        return sensor.status();
        break;
      case 4:
        return sensor.label();
        break;
    }
  } else if ( role == Qt::DecorationRole ) {
    if ( index.column() == 1 ) {
      if ( sensor.color().isValid() ) {
        QPixmap pm( 12, 12 );
        pm.fill( sensor.color() );

        return pm;
      }
    }
  }

  return QVariant();
}
Status RecordStoreV1Base::touch(OperationContext* txn, BSONObjBuilder* output) const {
    Timer t;

    std::vector<touch_location> ranges;
    {
        DiskLoc nextLoc = _details->firstExtent(txn);
        Extent* ext = nextLoc.isNull() ? NULL : _getExtent(txn, nextLoc);
        while (ext) {
            touch_location tl;
            tl.root = reinterpret_cast<const char*>(ext);
            tl.length = ext->length;
            ranges.push_back(tl);

            nextLoc = ext->xnext;
            if (nextLoc.isNull())
                ext = NULL;
            else
                ext = _getExtent(txn, nextLoc);
        }
    }

    std::string progress_msg = "touch " + std::string(txn->getNS()) + " extents";
    stdx::unique_lock<Client> lk(*txn->getClient());
    ProgressMeterHolder pm(
        *txn->setMessage_inlock(progress_msg.c_str(), "Touch Progress", ranges.size()));
    lk.unlock();

    for (std::vector<touch_location>::iterator it = ranges.begin(); it != ranges.end(); ++it) {
        touch_pages(it->root, it->length);
        pm.hit();
        txn->checkForInterrupt();
    }
    pm.finished();

    if (output) {
        output->append("numRanges", static_cast<int>(ranges.size()));
        output->append("millis", t.millis());
    }

    return Status::OK();
}
Example #20
0
void Energy::train()
{
  try{
    cout<<"A:\n"<<A<<endl;
    cout<<"b:\n"<<b<<endl;


    /*** linear least squares ***/
    la::matrix<double> AT = la::trans(A);
    la::matrix<double> ATA = la::prod(AT,A);
    la::vector<double> ATb = la::prod(AT,b);
    la::permutation_matrix<int> pm(ATA.size1());
    la::lu_factorize(ATA,pm);
    la::vector<double> c(ATb);
    lu_substitute(ATA, pm, c); 
    la::vector<double> est = la::prod(A,c);

    /*** set coeffficients  ***/
    set_coefficients(c);
    
    /*  cout<<"A:\n"<<print_matrix(A)<<endl;
	cout<<"b:\n"<<print_matrix(b)<<endl;
	cout<<"AT:\n"<<print_matrix(AT)<<endl;
	cout<<"ATA:\n"<<print_matrix(ATA)<<endl;
	cout<<"ATb:\n"<<print_matrix(ATb)<<endl;
	cout<<"ATA - after:\n"<<print_matrix(ATA)<<endl;
	cout<<"c:\n"<<print_matrix(c)<<endl;
	cout<<"est:\n"<<print_matrix(est)<<endl;
    */
    cout<<"TRAINING DONE"<<endl;
  }
  catch(...)
    {
      cout<<"WARNING: Training fail, will stil write matices to octave file"<<endl;
      
    }


  cout<<"Done writting to octave file"<<endl;

}
void object::test<1>
()
{
    std::string
    wkt0("LINESTRING(99739.70596 -2239218.0625,99739.85604 -2239218.21258,99739.85605 -2239218.21258, 99739.85605 -2239218.21258,99739.86851 -2239218.21258,99739.86851 -2239218.20012, 99739.86851 -2239218.20012,99739.86851 -2239218.04, 99739.95848 -2239218.11015,99739.86851 -2239218.20012, 99739.86851 -2239218.20012,99739.85605 -2239218.21258, 99739.85605 -2239218.21258,99739.80901 -2239218.25961, 99739.80901 -2239218.25961,99739.68863 -2239218.38, 99739.86204 -2239218.31264,99739.80901 -2239218.25961, 99739.80901 -2239218.25961,99739.66841 -2239218.11901)");
    SegStrVct nodable;
    getSegmentStrings(wkt0, nodable);
    ensure_equals(nodable.size(), 1u);

    PrecisionModel pm(1e-5);
    MCIndexSnapRounder noder(pm);

    ensure_equals(nodable.size(), 1u);
    noder.computeNodes(&nodable);
    std::unique_ptr<SegStrVct> noded(noder.getNodedSubstrings());

    ensure_equals("1e-5", noded->size(), 178u);

    freeSegmentStrings(*noded);
    freeSegmentStrings(nodable);
}
Example #22
0
void ZFonts::fillFontsByDir(QString sDir)
{
	QStringList slFonts;
	slFonts.clear();
	QDir dir( sDir );
	dir.setFilter( QDir::Files );
	dir.setNameFilter("*.ttf;*.TTF");
	slFonts = dir.entryList();
	
	QString * path;
	QPixmap pm( ProgDir + "/fonts.png");
	for ( QStringList::Iterator it = slFonts.begin(); it != slFonts.end(); ++it ) 
	{
		ZSettingItem* item = new ZSettingItem(lbFonts, "%I%M");
		item->setPixmap( 0, pm  );
		item->appendSubItem( 1, QString::fromUtf8(*it) );
		path = new QString(sDir+"/"+(*it));
		item->setReservedData( (int)path );
		lbFonts->insertItem( item );      
	}
}
QBrush DesktopBackgroundDialog::background()
{
    QBrush background;
    switch (m_type)
    {
        case (RazorWorkSpaceManager::BackgroundPixmap):
        {
            QPixmap pm(m_wallpaper);
            pm = pm.scaled(m_desktopSize,
                           keepAspectCheckBox->isChecked() ? Qt::KeepAspectRatio : Qt::IgnoreAspectRatio,
                           Qt::SmoothTransformation);
            background.setTexture(pm);
            break;
        }
        default:
            background.setColor(m_color);
            background.setStyle(Qt::SolidPattern);
    }
    save();
    return background;
}
Example #24
0
void SettingsButton::paintEvent(QPaintEvent *event)
{
	QPushButton::paintEvent(event);
	QStyleOptionButton option;
	option.initFrom(this);
	QRect r = this->rect();

	// Prepare miage in pixmap using mask
	QPixmap pm(r.size());
	pm.fill(Qt::transparent);
	pm.fill(option.palette.windowText().color());
	QIcon w(":cogwheel");
	QPainter ppm(&pm);
	ppm.setCompositionMode(QPainter::CompositionMode_DestinationIn);
	ppm.drawPixmap(0,0,w.pixmap(r.size()));

	// Draw pixmap on button
	QPainter p(this);
	p.setRenderHint(QPainter::Antialiasing, true);
	p.drawPixmap(0,0,pm);
}
Example #25
0
File: main.cpp Project: mpvader/qt
static QPixmap createDestPixmap()
{
    const int colorbands = 3;
    const int intensities = 4;
    QPixmap pm( 32, colorbands*intensities*4 );
    QPainter painter;
    painter.begin( &pm );
    for ( int i=0; i<colorbands; i++ ) {
	for ( int j=0; j<intensities; j++ ) {
	    int intensity = 255 * (j+1) / intensities; // 25%, 50%, 75% and 100%
	    for ( int k=0; k<8; k++ ) {
		QColor col = baseColor( k, intensity );
		painter.setPen( QPen( col, 1 ) );
		painter.setBrush( col );
		painter.drawRect( k*4, j*4 + i*intensities*4, 4, 4 );
	    }
	}
    }
    painter.end();
    return pm;
}
Example #26
0
int64_t HaltonSampler::GetIndexForSample(int64_t sampleNum) const {
    if (currentPixel != pixelForOffset) {
        // Compute Halton sample offset for _currentPixel_
        offsetForCurrentPixel = 0;
        if (sampleStride > 1) {
            Point2i pm(Mod(currentPixel[0], kMaxResolution),
                       Mod(currentPixel[1], kMaxResolution));
            for (int i = 0; i < 2; ++i) {
                uint64_t dimOffset =
                    (i == 0)
                        ? InverseRadicalInverse<2>(pm[i], baseExponents[i])
                        : InverseRadicalInverse<3>(pm[i], baseExponents[i]);
                offsetForCurrentPixel +=
                    dimOffset * (sampleStride / baseScales[i]) * multInverse[i];
            }
            offsetForCurrentPixel %= sampleStride;
        }
        pixelForOffset = currentPixel;
    }
    return offsetForCurrentPixel + sampleNum * sampleStride;
}
Example #27
0
		void StageSettings::identifyDisplays()
		{
			// loop over all displays
			// (we iterate until size() - 1 because there's also
			// 'disabled' in the combo box)
			for (int i=0; i<std::max(0, controlScreen_comboBox->count() - 1); ++i)
			{
				QPainter p;

				// create a transparent background image
				QImage pm(250, 250, QImage::Format_ARGB32);
				pm.fill(qRgba(0, 0, 0, 0));

				p.begin(&pm);

				QFont text_font("Arial", 200, QFont::Bold);

				QPainterPath text_path;
				text_path.addText(QPointF(10.f, 220.f), text_font, QString::number(i));

				QLinearGradient gradient(0, 0, 0, 100);
				gradient.setColorAt(0.0, qRgba(0, 0, 128, 0));
				gradient.setColorAt(1.0, qRgba(0, 128, 128, 0));

				p.setBrush(gradient);
				p.setPen(QPen(QColor(0, 0, 0), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));

				p.drawPath(text_path);
				p.end();

				pm.createAlphaMask();

				QSplashScreen* splash = new QSplashScreen(QApplication::desktop()->screen(i), QPixmap::fromImage(pm));
				splash->show();

				identification_labels_.push_back(splash);
			}

			QTimer::singleShot(2000, this, SLOT(killIdentificationLabels_()));
		}
Example #28
0
void NewDevice::fillTree()
{
  QListViewItem* parent = NULL;
  QListViewItem* newItem = NULL;

  QList <DeviceClass> dclist(_app->doc()->deviceClassList());
  QPixmap pm(_app->settings()->pixmapPath() + QString("dmx.xpm"));

  m_tree->clear();

  for (DeviceClass* dc = dclist.first(); dc != NULL; dc = dclist.next())
    {
      bool alreadyAdded = false;

      for (QListViewItem* i = m_tree->firstChild(); i != NULL; i = i->nextSibling())
	{
	  if (i->text(0) == dc->manufacturer())
	    {
	      alreadyAdded = true;
	      parent = i;
	      break;
	    }
	}

      if (alreadyAdded == false)
	{
	  parent = new QListViewItem(m_tree, dc->manufacturer());
	  if (_app->settings()->newDeviceTreeOpen() == true)
	    {
	      parent->setOpen(true);
	    }
	}

      parent->setPixmap(0, QPixmap(_app->settings()->pixmapPath() + QString("global.xpm")));

      newItem = new QListViewItem(parent, dc->model());
      newItem->setPixmap(0, pm);
      newItem->setText(1,dc->type());
    }
}
Example #29
0
void Step1::init()
{
  Input *option;
  m_projName->setText(getStringOption(m_modelData,STR_PROJECT_NAME));
  m_projBrief->setText(getStringOption(m_modelData,STR_PROJECT_BRIEF));
  m_projNumber->setText(getStringOption(m_modelData,STR_PROJECT_NUMBER));
  QString iconName = getStringOption(m_modelData,STR_PROJECT_LOGO);
  if (!iconName.isEmpty())
  {
    QFile Fout(iconName);
    if(!Fout.exists()) 
    {
      m_projIconLab->setText(tr("Sorry, cannot find file(")+iconName+QString::fromAscii(");"));
    }
    else
    {
      QPixmap pm(iconName);
      if (!pm.isNull())
      {
        m_projIconLab->setPixmap(pm.scaledToHeight(55,Qt::SmoothTransformation));
      }
      else
      {
        m_projIconLab->setText(tr("Sorry, no preview available (")+iconName+QString::fromAscii(");"));
      }
    }
  }
  else
  {
    m_projIconLab->setText(tr("No Project logo selected."));
  }
  option = m_modelData[STR_INPUT];
  if (option->value().toStringList().count()>0)
  {
    m_sourceDir->setText(option->value().toStringList().first());
  }
  m_recursive->setChecked(
      getBoolOption(m_modelData,STR_RECURSIVE) ? Qt::Checked : Qt::Unchecked);
  m_destDir->setText(getStringOption(m_modelData,STR_OUTPUT_DIRECTORY));
}
Example #30
0
Status RecordStoreV1Base::touch( OperationContext* txn, BSONObjBuilder* output ) const {
    Timer t;

    // Note: when this class has document level locking, we'll need a lock to get extents
    // and then ideally only hold the collection lock from above while doing actual touching.

    std::vector<touch_location> ranges;
    {
        Extent* ext = _getExtent( _details->firstExtent() );
        while ( ext ) {
            touch_location tl;
            tl.root = reinterpret_cast<const char*>(ext);
            tl.length = ext->length;
            ranges.push_back(tl);
            if ( ext->xnext.isNull() )
                ext = NULL;
            else
                ext = _getExtent( ext->xnext );
        }
    }

    std::string progress_msg = "touch " + std::string(txn->getNS()) + " extents";
    ProgressMeterHolder pm(*txn->setMessage(progress_msg.c_str(),
                                            "Touch Progress",
                                            ranges.size()));

    for ( std::vector<touch_location>::iterator it = ranges.begin(); it != ranges.end(); ++it ) {
        touch_pages( it->root, it->length );
        pm.hit();
        txn->checkForInterrupt();
    }
    pm.finished();

    if ( output ) {
        output->append( "numRanges", static_cast<int>( ranges.size() ) );
        output->append( "millis", t.millis() );
    }

    return Status::OK();
}