Esempio n. 1
0
void MainWindow::connectKernelToUI()
{
    connect(ui->comboBoxTxSpeed, SIGNAL(activated(QString)), this, SLOT(slotSetConnectionSpeed(QString)));
    connect(ui->comboBoxTxOutputPower, SIGNAL(activated(QString)), this, SLOT(slotSetOutputPower(QString)));
    connect(ui->comboBoxTxModulation, SIGNAL(activated(int)), this, SLOT(slotSetModulationType(int)));
    connect(ui->comboBoxTxBitSynch, SIGNAL(activated(QString)), this, SLOT(slotSetPreambleLength(QString)));
    connect(ui->comboBoxTxSynch, SIGNAL(activated(QString)), this, SLOT(slotSetSyncPatternLength(QString)));
    connect(ui->lineEditTxPacketDataLength, SIGNAL(textChanged(QString)), this, SLOT(slotSetDataPacketLength(QString)));
    connect(ui->lineEditTxTotalDataLength, SIGNAL(textChanged(QString)), this, SLOT(slotSetTotalDataLength(QString)));
    connect(ui->pushButtonTxStart, SIGNAL(clicked()), m_pKernel, SLOT(slotStartOperation()));
    connect(ui->pushButtonTxStop, SIGNAL(clicked()), m_pKernel, SLOT(slotStopOperation()));
    connect(ui->comboBoxTxCRC, SIGNAL(currentIndexChanged(int)), m_pKernel, SLOT(slotSetCrcType(int)));

    connect(m_pKernel, SIGNAL(signalNewConnectionSpeed(int)), this, SLOT(slotNewConnectionSpeed(int)));
    connect(m_pKernel, SIGNAL(signalNewOutputPower(int)), this, SLOT(slotNewOutputPower(int)));
    connect(m_pKernel, SIGNAL(signalNewModulationType(int)), this, SLOT(slotNewModulationType(int)));
    connect(m_pKernel, SIGNAL(signalNewTotalDataLength(int)), this, SLOT(slotNewTotalDataLength(int)));
    connect(m_pKernel, SIGNAL(signalShowBER(qreal)), this, SLOT(slotNewBER(qreal)));
    connect(m_pKernel, SIGNAL(signalShowPER(qreal)), this, SLOT(slotNewPER(qreal)));
    connect(m_pKernel, SIGNAL(signalShowChannelUtilizationPayload(qreal)), this, SLOT(slotNewChannelUtilizationPayload(qreal)));
    connect(m_pKernel, SIGNAL(signalShowChannelUtilizationSerivce(qreal)), this, SLOT(slotNewChannelUtilizationSerivce(qreal)));
    connect(m_pKernel, SIGNAL(signalShowRxSpeed(qreal)), this, SLOT(slotNewRxSpeed(qreal)));
    connect(m_pKernel, SIGNAL(signalUpdateStatistics()), this, SLOT(slotUpdateStatistics()));
}
Esempio n. 2
0
int main(int argc, char *argv[])
{
	//Initialization of system functions
	InitSystem();

	//configure debug output
	qInstallMessageHandler(myMessageOutput);

	//class for interface windows
	gMainInterface = new cInterface;

	WriteLog("Prepare QApplication", 2);
	QCoreApplication *gCoreApplication = new QCoreApplication(argc, argv);
	gCoreApplication->setOrganizationName("Mandelbulber");
	gCoreApplication->setApplicationName("Mandelbulber");
	gCoreApplication->setApplicationVersion(MANDELBULBER_VERSION_STRING);

	UpdateLanguage(gCoreApplication);

	cCommandLineInterface commandLineInterface(gApplication);

	if (commandLineInterface.isNoGUI())
	{
		gApplication = qobject_cast<QApplication *>(gCoreApplication);
	}
	else
	{
		delete gCoreApplication;
		gApplication = new QApplication(argc, argv);
		gApplication->setOrganizationName("Mandelbulber");
		gApplication->setApplicationName("Mandelbulber");
		gApplication->setApplicationVersion(MANDELBULBER_VERSION_STRING);
	}

	//registering types for queued connections
	qRegisterMetaType<cStatistics>("cStatistics");
	qRegisterMetaType<QList<QByteArray> >("QList<QByteArray>");
	qRegisterMetaType<QList<int> >("QList<int>");
	qRegisterMetaType<cParameterContainer>("cParameterContainer");
	qRegisterMetaType<cFractalContainer>("cFractalContainer");
	qRegisterMetaType<sTextures>("sTextures");
	qRegisterMetaType<cProgressText::enumProgressType>("cProgressText::enumProgressType");
	qRegisterMetaType<QVector<int> >("QVector<int>");
	qRegisterMetaType<CVector2<double> >("CVector2<double>");
	qRegisterMetaType<QMessageBox::StandardButtons>("QMessageBox::StandardButtons");
	qRegisterMetaType<QMessageBox::StandardButtons*>("QMessageBox::StandardButtons*");
	qRegisterMetaType<cErrorMessage::enumMessageType>("cErrorMessage::enumMessageType");

	gErrorMessage = new cErrorMessage;

	//create default directories and copy all needed files
	WriteLog("CreateDefaultFolders()", 2);
	if (!CreateDefaultFolders())
	{
		qCritical() << "Files/directories initialization failed" << endl;
		return 73;
	}

	//create internal database with parameters
	gPar = new cParameterContainer;
	gParFractal = new cFractalContainer;

	//Allocate container for animation frames
	gAnimFrames = new cAnimationFrames;

	//Allocate container for key frames
	gKeyframes = new cKeyframes;

	gPar->SetContainerName("main");
	InitParams(gPar);
	for (int i = 0; i < NUMBER_OF_FRACTALS; i++)
	{
		gParFractal->at(i).SetContainerName(QString("fractal") + QString::number(i));
		InitFractalParams(&gParFractal->at(i));
	}

	/****************** TEMPORARY CODE FOR MATERIALS *******************/

	//InitMaterialParams(1, gPar);
	//InitMaterialParams(2, gPar);
	//InitMaterialParams(3, gPar);

	/*******************************************************************/

	//Define list of fractal formulas
	DefineFractalList(&fractalList);

	//Netrender
	gNetRender = new CNetRender(systemData.numberOfThreads);

	//loading AppSettings
	if (QFile(systemData.dataDirectory + "mandelbulber.ini").exists())
	{
		cSettings parSettings(cSettings::formatAppSettings);
		parSettings.LoadFromFile(systemData.dataDirectory + "mandelbulber.ini");
		parSettings.Decode(gPar, gParFractal);
	}

	systemData.loggingVerbosity = gPar->Get<int>("logging_verbosity");

	UpdateDefaultPaths();
	if (!commandLineInterface.isNoGUI())
	{
		UpdateUIStyle();
		UpdateUISkin();
	}
	UpdateLanguage(gApplication);

	commandLineInterface.ReadCLI();

	if (!commandLineInterface.isNoGUI())
	{
		gMainInterface->ShowUi();
		gFlightAnimation = new cFlightAnimation(gMainInterface,
																						gAnimFrames,
																						gMainInterface->mainImage,
																						gMainInterface->renderedImage,
																						gPar,
																						gParFractal,
																						gMainInterface->mainWindow);
		gKeyframeAnimation = new cKeyframeAnimation(gMainInterface,
																								gKeyframes,
																								gMainInterface->mainImage,
																								gMainInterface->renderedImage,
																								gPar,
																								gParFractal,
																								gMainInterface->mainWindow);

		QObject::connect(gFlightAnimation,
										 SIGNAL(updateProgressAndStatus(const QString&, const QString&, double, cProgressText::enumProgressType)),
										 gMainInterface->mainWindow,
										 SLOT(slotUpdateProgressAndStatus(const QString&, const QString&, double, cProgressText::enumProgressType)));
		QObject::connect(gFlightAnimation,
										 SIGNAL(updateProgressHide(cProgressText::enumProgressType)),
										 gMainInterface->mainWindow,
										 SLOT(slotUpdateProgressHide(cProgressText::enumProgressType)));
		QObject::connect(gFlightAnimation,
										 SIGNAL(updateStatistics(cStatistics)),
										 gMainInterface->mainWindow,
										 SLOT(slotUpdateStatistics(cStatistics)));
		QObject::connect(gKeyframeAnimation,
										 SIGNAL(updateProgressAndStatus(const QString&, const QString&, double, cProgressText::enumProgressType)),
										 gMainInterface->mainWindow,
										 SLOT(slotUpdateProgressAndStatus(const QString&, const QString&, double, cProgressText::enumProgressType)));
		QObject::connect(gKeyframeAnimation,
										 SIGNAL(updateProgressHide(cProgressText::enumProgressType)),
										 gMainInterface->mainWindow,
										 SLOT(slotUpdateProgressHide(cProgressText::enumProgressType)));
		QObject::connect(gKeyframeAnimation,
										 SIGNAL(updateStatistics(cStatistics)),
										 gMainInterface->mainWindow,
										 SLOT(slotUpdateStatistics(cStatistics)));

		try
		{
			gQueue = new cQueue(gMainInterface,
													systemData.dataDirectory + "queue.fractlist",
													systemData.dataDirectory + "queue",
													gMainInterface->mainWindow);
		} catch (QString &ex)
		{
			cErrorMessage::showMessage(QObject::tr("Cannot init queue: ") + ex,
																 cErrorMessage::errorMessage);
			return -1;
		}
	}