Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • adfc2e5
  • /
  • topo-blend
  • /
  • wizard.cpp
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:39d514bffc6bf62f079c99e5833ee60c45e57423
directory badge Iframe embedding
swh:1:dir:4cd23d1e54634cfb4ba85fc907bddef6128f3245

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
wizard.cpp
#include "wizard.h"
#include "ui_wizard.h"

#include "topo-blend.h"
#include "graphs-manager.h"
#include "SynthesisManager.h"
#include "correspondence-manager.h"
#include "Scheduler.h"
#include "SchedulerWidget.h"

#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QGraphicsOpacityEffect>
Q_DECLARE_METATYPE(QGraphicsOpacityEffect*)

QtAwesome* awesome = new QtAwesome( qApp );

// Styling
QString style_ok = "color: rgb(81, 163, 81)";
QString style_wait = "color: rgb(248, 148, 6)";
QString style_bad = "color: rgb(189, 54, 47)";
QString style_info = "color: rgb(47, 150, 180)";

Wizard::Wizard(topoblend *tobo_blend, QWidget * parentWidget) : QWidget(parentWidget), tb(tobo_blend), ui(new Ui::Wizard)
{
	awesome->initFontAwesome();

    ui->setupUi(this);

	// Connections
	{
		this->connect(ui->loadAButton, SIGNAL(clicked()), SLOT(loadShapeA()));
		this->connect(ui->loadBButton, SIGNAL(clicked()), SLOT(loadShapeB()));
		this->connect(ui->matchingButton, SIGNAL(clicked()), SLOT(matchingButton()));
		this->connect(ui->generateButton, SIGNAL(clicked()), SLOT(generateBlend()));
	}

	// Layouts
	{
		layouts.push_back(ui->layoutLoading);
		layouts.push_back(ui->layoutMatching);
		layouts.push_back(ui->layoutOrder);
		layouts.push_back(ui->layoutQuality);
		layouts.push_back(ui->layoutGenerate);

		foreach(QLayout * l, layouts){
			for(int i = 0; i < l->count(); i++){
				QWidget * item = l->itemAt(i)->widget();
				if(!item) continue;
				
				// Add transparency effect
				QGraphicsOpacityEffect * effect = new QGraphicsOpacityEffect(item);
				effect->setOpacity(0);
				item->setGraphicsEffect(effect);
				QVariant var; var.setValue(effect);
				item->setProperty("opacity", var);
			}
		}

	}

	// Icons / check marks
	{
		icons.push_back(ui->checkLoad);
		icons.push_back(ui->checkMatch);
		icons.push_back(ui->checkOrder);
		icons.push_back(ui->checkQuality);

		QFont fnt = awesome->font(16);
		foreach(QLabel * l, icons) {
			l->setFont( fnt );
			l->setStyleSheet( style_wait ); 
		}
	}

	// Fade window in
	if(false){
		this->setWindowOpacity(0);

		QPropertyAnimation *animation = new QPropertyAnimation(this,"windowOpacity");
		animation->setDuration(1000);
		animation->setStartValue(0.0);
		animation->setEndValue(1.0);
		animation->setEasingCurve(QEasingCurve::OutCubic);
		animation->start();
	}

	// Fade first step in
	setOpacity("layoutLoading", 1.0);
}

void Wizard::setOpacity( QString objName, double toValue )
{
	QParallelAnimationGroup * animGroup = new QParallelAnimationGroup;

	foreach(QLayout * l, layouts){
		if(l->objectName() != objName) continue;
		for(int i = 0; i < l->count(); i++){
			QWidget * item = l->itemAt(i)->widget();
			if(!item) continue;

			QGraphicsOpacityEffect * opacityEffect = item->property("opacity").value<QGraphicsOpacityEffect*>();
			QPropertyAnimation* anim = new QPropertyAnimation;
			anim->setTargetObject(opacityEffect);
			anim->setPropertyName("opacity");
			anim->setDuration(1000);
			anim->setStartValue(opacityEffect->opacity());
			anim->setEndValue(toValue);
			anim->setEasingCurve(QEasingCurve::OutQuad);

			animGroup->addAnimation(anim);
		}
	}

	animGroup->start( QAbstractAnimation::DeleteWhenStopped );
}

Wizard::~Wizard()
{
    delete ui;
}

void Wizard::loadShapeA()
{
	tb->g_manager->loadModel();
	tb->c_manager->visualizeAsSolids();

	ui->loadAButton->setStyleSheet(style_ok);

	tb->updateDrawArea();
}

void Wizard::loadShapeB()
{
	tb->g_manager->loadModel();
	tb->c_manager->visualizeAsSolids();

	ui->loadBButton->setStyleSheet(style_ok);

	setOpacity("layoutMatching", 1.0);
	setOpacity("layoutQuality", 1.0);

	tb->updateDrawArea();
}

void Wizard::matchingButton()
{
	if(ui->matchingButton->text().contains("Set..")){
		ui->matchingButton->setText("Done?");
		tb->c_manager->correspondenceMode();
	}else{
		ui->matchingButton->setText("Done");
		ui->matchingButton->setStyleSheet(style_ok);

		//setOpacity("layoutOrder", 1.0);
		setOpacity("layoutGenerate", 1.0);

		tb->doBlend();

		double synthQuality = (ui->synthQuality->value()) / 100.0;
		if(synthQuality > 0){

			int samplesCount = 25000 * pow(synthQuality, 2);
			tb->widget->setSynthSamplesCount( samplesCount );

			tb->s_manager->generateSynthesisData();
		}
	}

	tb->updateDrawArea();
}

void Wizard::generateBlend()
{
	tb->scheduler->doBlend();

	tb->updateDrawArea();
}

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API