Beispiel #1
0
void TextureChooser::onFileTxtRowChanged( int row )
{
	if( row < 0 )
		return;

	QListWidgetItem *item = d_ptr->fileTextures->item( row );
	QString fn = item->text();

	std::string rfn = fn.toUtf8().constData();
	rfn = NLMISC::CPath::lookup( rfn );
	
	NLMISC::CIFile f;
	bool b = f.open( rfn );
	if( !b )
	{
		return;
	}

	NLMISC::CBitmap bm;
	uint8 depth = bm.load( f );
	f.close();
	b = bm.convertToType( NLMISC::CBitmap::RGBA );
	if( !b )
	{
		return;
	}

	setPreviewImage( bm );
}
Beispiel #2
0
void DishInfoDialog::setMenuItem(CBMenuItem* item)
{
    ui->listWidgetTags->clear();
    this->_menuItem = item;

    if (!item)
        return;

    CBDish dish = _menuItem->getDish();

    ui->lineEditId->setText(dish.getId().toString());
    ui->lineEditName->setText(dish.getName());

    setTags(dish.getTagsSet());

    ui->lineEditPrice->setText(QString::number(dish.getPrice()));
    ui->lineEditScore->setText(QString::number(dish.getScore()));
    ui->lineEditSummary->setText(dish.getSummary());
    ui->textEditDetail->setText(dish.getDetail());

    QString thumbPath = item->getRecordDir() + QString(CBPATH_SPLITOR) + dish.getThumb();
    QString picturePath = item->getRecordDir() + QString(CBPATH_SPLITOR) + dish.getPicture();

    ui->lineEditThumb->setText(thumbPath);
    ui->lineEditPicture->setText(picturePath);

    setPreviewImage(thumbPath);

    clearWarning();
}
Beispiel #3
0
void EditorToolThreaded::slotFilterFinished(bool success)
{
    if (success)        // Computation Completed !
    {
        switch (d->currentRenderingMode)
        {
            case EditorToolThreaded::PreviewRendering:
            {
                kDebug() << "Preview " << toolName() << " completed...";
                setPreviewImage();
                slotAbort();
                break;
            }

            case EditorToolThreaded::FinalRendering:
            {
                kDebug() << "Final" << toolName() << " completed...";
                setFinalImage();
                EditorToolIface::editorToolIface()->setToolStopProgress();
                kapp->restoreOverrideCursor();
                emit okClicked();
                break;
            }

            default:
                break;
        }
    }
    else                   // Computation Failed !
    {
        switch (d->currentRenderingMode)
        {
            case EditorToolThreaded::PreviewRendering:
            {
                kDebug() << "Preview " << toolName() << " failed...";
                slotAbort();
                break;
            }

            case EditorToolThreaded::FinalRendering:
            default:
                break;
        }
    }
}
Beispiel #4
0
void TextureChooser::onAtlasTxtRowChanged( int row )
{
	if( row < 0 )
		return;

	QListWidgetItem *item = d_ptr->atlasTextures->item( row );
	QString fn = item->text();

	std::string rfn = fn.toUtf8().constData();

	NLMISC::CBitmap bm;

	bool b = NLGUI::CViewRenderer::getInstance()->getTexture( bm, rfn );
	if( !b )
		return;
	
	setPreviewImage( bm );
}