cRenderQueue::cRenderQueue(cImage *_image, RenderedImage *widget) : QObject()
{
	image = _image;
	imageWidget = widget;
	queuePar = new cParameterContainer;
	queueParFractal = new cFractalContainer;
	queueAnimFrames = new cAnimationFrames;
	queueKeyframes = new cKeyframes;

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

	queueFlightAnimation = new cFlightAnimation(gMainInterface, queueAnimFrames, image, imageWidget, queuePar, queueParFractal, this);
	queueKeyframeAnimation = new cKeyframeAnimation(gMainInterface, queueKeyframes, image, imageWidget, queuePar, queueParFractal, this);
	QObject::connect(queueFlightAnimation, SIGNAL(updateProgressAndStatus(const QString&, const QString&, double, cProgressText::enumProgressType)),
									 this, SIGNAL(updateProgressAndStatus(const QString&, const QString&, double, cProgressText::enumProgressType)));
	QObject::connect(queueFlightAnimation, SIGNAL(updateProgressHide(cProgressText::enumProgressType)),
									 this, SIGNAL(updateProgressHide(cProgressText::enumProgressType)));
	QObject::connect(queueFlightAnimation, SIGNAL(updateStatistics(cStatistics)),
									 this, SIGNAL(updateStatistics(cStatistics)));
	QObject::connect(queueKeyframeAnimation, SIGNAL(updateProgressAndStatus(const QString&, const QString&, double, cProgressText::enumProgressType)),
									 this, SIGNAL(updateProgressAndStatus(const QString&, const QString&, double, cProgressText::enumProgressType)));
	QObject::connect(queueKeyframeAnimation, SIGNAL(updateProgressHide(cProgressText::enumProgressType)),
									 this, SIGNAL(updateProgressHide(cProgressText::enumProgressType)));
	QObject::connect(queueKeyframeAnimation, SIGNAL(updateStatistics(cStatistics)),
									 this, SIGNAL(updateStatistics(cStatistics)));
}
Example #2
0
ODBCDialog::ODBCDialog(QWidget *parent, const char *name) : qt_mainDialog(parent,name)
{
	// Initialise stuff...
    statsHandle = 0;
	progressMaxValue = 0;

	// Disable user and program columns if /proc does not exist...
	if (QFile::exists("/proc") == FALSE)
	{
		detailsTable->hideColumn(0);
		detailsTable->hideColumn(1);
	}

	// Get initial statistics...
	updateStatistics();

	// Configure and start the statistics refresh timer...
	statsTimer = new QTimer(this);
	statsTimer->start(timerSpin->value() * 100, FALSE);

	// Connect SIGNAL / SLOTS...
	connect(timerSpin, SIGNAL(valueChanged(int)), this, SLOT(updateTimer(int)));
	connect(statsTimer, SIGNAL(timeout()), this, SLOT(updateStatistics()));
	connect(aboutButton, SIGNAL(clicked()), this, SLOT(about()));
}
Example #3
0
bool cRenderQueue::RenderStill(const QString& filename)
{
	QString extension;
	enumImageFileType imageFormat = (enumImageFileType) gPar->Get<int>("queue_image_format");
	extension = ImageFileExtension(imageFormat);
	QString saveFilename = QFileInfo(filename).baseName() + extension;

	//setup of rendering engine
	cRenderJob *renderJob = new cRenderJob(queuePar,
																				 queueParFractal,
																				 image,
																				 &gQueue->stopRequest,
																				 imageWidget);

	connect(renderJob,
					SIGNAL(updateProgressAndStatus(const QString&, const QString&, double)),
					this,
					SIGNAL(updateProgressAndStatus(const QString&, const QString&, double)));
	connect(renderJob,
					SIGNAL(updateStatistics(cStatistics)),
					this,
					SIGNAL(updateStatistics(cStatistics)));

	cRenderingConfiguration config;
	if (systemData.noGui)
	{
		config.DisableProgressiveRender();
		config.DisableRefresh();
	}
	config.EnableNetRender();
	renderJob->Init(cRenderJob::still, config);

	gQueue->stopRequest = false;

	//render image
	bool result = renderJob->Execute();
	if (!result)
	{
		delete renderJob;
		return false;
	}

	QString fullSaveFilename = gPar->Get<QString>("default_image_path") + QDir::separator()
			+ saveFilename;
	SaveImage(fullSaveFilename, imageFormat, image);

	fullSaveFilename = gPar->Get<QString>("default_image_path") + QDir::separator()
			+ QFileInfo(filename).baseName() + ".fract";
	cSettings parSettings(cSettings::formatCondensedText);
	parSettings.CreateText(queuePar, queueParFractal);
	parSettings.SaveToFile(fullSaveFilename);

	delete renderJob;
	return true;
}
Example #4
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{    
    HomeWidget* homeWidget = new HomeWidget;
    SettingsWidget* settingsWidget = new SettingsWidget;
    LogsWidget* logsWidget = new LogsWidget;
    ScreenshotWidget* screenshotWidget = new ScreenshotWidget;
    BrowseTimeWidget* browseTimeWidget = new BrowseTimeWidget;
    WebsiteLockerWidget* websiteLockerWidget = new WebsiteLockerWidget;
    ProgramLockerWidget* programLockerWidget = new ProgramLockerWidget;

    currentPageLabel = new QLabel;
    versionLabel = new QLabel;
    versionLabel->setObjectName("versionLabel");

    connect(homeWidget,SIGNAL(updateModel()),settingsWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),logsWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),screenshotWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),browseTimeWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),websiteLockerWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),programLockerWidget,SLOT(updateUsersModel()));

    connect(homeWidget,SIGNAL(registerd()),this,SLOT(readAvailableDays()));

    connect(this,SIGNAL(updateLogs()),logsWidget,SLOT(updateLog()));
    connect(this,SIGNAL(updateScreenshots()),screenshotWidget,SLOT(updateScreenshot()));
    connect(this,SIGNAL(updateStatistics()),settingsWidget,SLOT(updateStatistics()));

    stackedWidget = new SlidingStackedWidget(this);
    stackedWidget->addWidget(homeWidget);
    stackedWidget->addWidget(settingsWidget);
    stackedWidget->addWidget(logsWidget);
    stackedWidget->addWidget(screenshotWidget);
    stackedWidget->addWidget(browseTimeWidget);
    stackedWidget->addWidget(websiteLockerWidget);
    stackedWidget->addWidget(programLockerWidget);
    stackedWidget->setSpeed(500);

    this->setCentralWidget(stackedWidget);
    createDockWidget();
    readAvailableDays();
    createStatusBar();

    this->setWindowTitle("نظام حاجب");
    this->setWindowIcon((QIcon(":/images/hajibIcon.ico")));
    this->setFixedWidth(800);
    this->setFixedHeight(600);

    this->setCurrentWindow(0);
}
Example #5
0
void InterfaceTree::getInterfaceList()
{
    display();
    resizeEvent(NULL);

#ifdef HAVE_LIBPCAP
    if (!stat_timer_) {
        updateStatistics();
        stat_timer_ = new QTimer(this);
        connect(stat_timer_, SIGNAL(timeout()), this, SLOT(updateStatistics()));
        stat_timer_->start(stat_update_interval_);
    }
#endif
}
Example #6
0
QgsRectangle QgsDb2Provider::extent() const
{
  QgsDebugMsg( QString( "entering; mExtent: %1" ).arg( mExtent.toString() ) );
  if ( mExtent.isEmpty() )
    updateStatistics();
  return mExtent;
}
Example #7
0
void MainWindow::setCurrentWindow(int id) {
    QString buttonToolTip ;
    QString buttonName = QString::number(id) + "_toolButton";
    QList<QPushButton*> buttons = rightPanelWidget->findChildren<QPushButton*>();
    foreach (QPushButton* button,buttons) {
        if (button->objectName() == buttonName) {
            button->setChecked(true);
            buttonToolTip = button->toolTip();
        }
        else
            button->setChecked(false);
    }

    stackedWidget->slideInIdx(id);

    // Update widget data.
    switch (id) {
    case ServiceLog:
        emit updateLogs();
        break;
    case ScreenshotMonitor:
        emit updateScreenshots();
        break;
    case UserSettings:
        emit updateStatistics();
    default:
        break;
    }

    currentPageLabel->setText("<font color=gray>"+buttonToolTip+"</font>");
    this->statusBar()->addPermanentWidget(currentPageLabel);
}
Example #8
0
StatisticsDock::StatisticsDock(QWidget *parent) :
    QDockWidget(parent)
{
    setWindowTitle(tr("Statistics"));
    QSplitter * mainSplitter = new QSplitter(this);
    mainSplitter->setOrientation(Qt::Vertical);

    QLabel * bootedUpTimeTextLabel = new QLabel("Booted up:",this);
    bootedUpTimeLabel = new QLabel("not available",this);

    QLabel * appRunningTimeTextLabel = new QLabel("Running for:",this);
    appRunningTimeLabel= new QLabel("0 s",this);

    QLabel * lastUpdateTextLabel = new QLabel("Last update:",this);
    lastUpdateLabel= new QLabel(QDateTime::currentDateTime().toString("hh:mm:ss"),this);

    mainSplitter->addWidget(bootedUpTimeTextLabel);
    mainSplitter->addWidget(bootedUpTimeLabel);

    mainSplitter->addWidget(appRunningTimeTextLabel);
    mainSplitter->addWidget(appRunningTimeLabel);


    mainSplitter->addWidget(lastUpdateTextLabel);
    mainSplitter->addWidget(lastUpdateLabel);
    mainSplitter->addWidget(new QWidget());

    setWidget(mainSplitter);

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(updateStatistics()));
    timer->start(iUpdateMs);
    elapsedTime = new QElapsedTimer();
    elapsedTime->start();
}
Example #9
0
void Game::run()
{
	sf::Clock clock;

	auto timeSinceLastUpdate = sf::Time::Zero;
	const auto TimePerFrame = sf::seconds(1 / 30.f);

	while (mRunning)
	{
		auto dt = clock.restart();
		timeSinceLastUpdate += dt;

		while (timeSinceLastUpdate > TimePerFrame)
		{
			timeSinceLastUpdate -= TimePerFrame;

			processEvents();
			update(TimePerFrame);
		}

		updateStatistics(dt);
		render();
	}

	mWindow.close();
}
Example #10
0
void Application::run()
{
	sf::Clock clock;
	sf::Time timeSinceLastUpdate = sf::Time::Zero;

	while (mWindow.isOpen())
	{
		sf::Time dt = clock.restart();
		timeSinceLastUpdate += dt;
		while (timeSinceLastUpdate > TimePerFrame)
		{
			timeSinceLastUpdate -= TimePerFrame;

			processInput();
			update(TimePerFrame);

			// Check inside this loop, because stack might be empty before update() call
			if (mStateStack.isEmpty())
				mWindow.close();
		}

		updateStatistics(dt);
		render();
	}
}
static void update(rfbClient* client,int x,int y,int w,int h) {
	clientData* cd=(clientData*)client->clientData;
	int maxDelta=0;

#ifndef VERY_VERBOSE
	static const char* progress="|/-\\";
	static int counter=0;

	if(++counter>sizeof(progress)) counter=0;
	fprintf(stderr,"%c\r",progress[counter]);
#else
	rfbClientLog("Got update (encoding=%s): (%d,%d)-(%d,%d)\n",
			testEncodings[cd->encodingIndex].str,
			x,y,x+w,y+h);
#endif

	/* only check if this was the last update */
	if(x+w!=lastUpdateRect.x2 || y+h!=lastUpdateRect.y2) {
#ifdef VERY_VERBOSE
		rfbClientLog("Waiting (%d!=%d or %d!=%d)\n",
				x+w,lastUpdateRect.x2,y+h,lastUpdateRect.y2);
#endif
		return;
	}

#ifdef LIBVNCSERVER_HAVE_LIBZ
	if(testEncodings[cd->encodingIndex].id==rfbEncodingTight)
		maxDelta=5;
#endif

	updateStatistics(cd->encodingIndex,
			!doFramebuffersMatch(cd->server,client,maxDelta));
}
Example #12
0
INT_PTR CALLBACK Caches(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message) {
    case WM_INITDIALOG:
        ::SetTimer(hDlg, IDT_UPDATE_STATS, 1000, nullptr);
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            ::KillTimer(hDlg, IDT_UPDATE_STATS);
            ::DestroyWindow(hDlg);
            hCacheWnd = 0;
            return (INT_PTR)TRUE;
        }
        break;

    case IDT_UPDATE_STATS:
        ::InvalidateRect(hDlg, nullptr, FALSE);
        return (INT_PTR)TRUE;

    case WM_PAINT:
        updateStatistics(hDlg);
        break;
    }

    return (INT_PTR)FALSE;
}
static void* clientLoop(void* data) {
	rfbClient* client=(rfbClient*)data;
	clientData* cd=(clientData*)client->clientData;

	client->appData.encodingsString=strdup(testEncodings[cd->encodingIndex].str);

	sleep(1);
	rfbClientLog("Starting client (encoding %s, display %s)\n",
			testEncodings[cd->encodingIndex].str,
			cd->display);
	if(!rfbInitClient(client,NULL,NULL)) {
		rfbClientErr("Had problems starting client (encoding %s)\n",
				testEncodings[cd->encodingIndex].str);
		updateStatistics(cd->encodingIndex,TRUE);
		return NULL;
	}
	while(1) {
		if(WaitForMessage(client,50)>=0)
			if(!HandleRFBServerMessage(client))
				break;
	}
	free(((clientData*)client->clientData)->display);
	free(client->clientData);
	if(client->frameBuffer)
		free(client->frameBuffer);
	rfbClientCleanup(client);
	return NULL;
}
SampleEditor::SampleEditor(QWidget * parent, Qt::WindowFlags flags)
: QMainWindow(parent,flags)
{
	table = new TableWindow();
	plot = new PlotWindow(this);
	histo = new HistoWindow(this);
	
	spdkNNGWin = NULL;

	data = NULL;
	data = vtkSmartPointer<vtkTable>::New();		//Start with a new table

	selection = new ObjectSelection();
	selection2 = new ObjectSelection();

	lastPath = ".";

	createMenus();
	createStatusBar();
	this->flag = 0;

	setCentralWidget(table);
	setWindowTitle(tr("SampleEditor-v1.0"));
	connect(selection, SIGNAL(changed()), this, SLOT(updateStatistics()));
    
	this->ClusterSelections = new SelectiveClustering();
	//this->SampleClusterManager = new ClusterManager();
	//this->SampleClusterManager->setClusteringModel(this->ClusterSelections );
	//this->SampleClusterManager->setObjectSelection(selection);
	//this->SampleClusterManager->setVisible(true);

	this->resize(500,500);
}
Example #15
0
 // === Database Synchronization ===
 void PBIBackend::slotSyncToDatabase(bool localChanges, bool all){
   qDebug() << "Sync Database with local changes:" << localChanges;
   updateSplashScreen(tr("Loading Database"));
   sysDB->syncDBInfo("", localChanges, all);
   PKGHASH.clear();
   APPHASH.clear();
   CATHASH.clear();
   if(RECLIST.isEmpty() || all){
     sysDB->getAppCafeHomeInfo( &NEWLIST, &HIGHLIST, &RECLIST);
   }
   //qDebug() << "Load APPHASH";
   PKGHASH = sysDB->DetailedPkgList(); // load the pkg info
   APPHASH = sysDB->DetailedAppList(); // load the pbi info
   CATHASH = sysDB->Categories(); // load all the different categories info
   if(BASELIST.isEmpty() || all){
      //populate the list of base dependencies that cannot be removed
      BASELIST = listDependencies("misc/pcbsd-base");
      BASELIST.removeDuplicates();
      //qDebug() << "Base:" << BASELIST;
   }
   updavail = checkForPkgUpdates("");
   if(RUNNINGJAILS.isEmpty() || all){ checkForJails(); }
   //qDebug() << "Update Stats";
   updateStatistics();
   //qDebug() << "Emit result";
   if(APPHASH.isEmpty() && PKGHASH.isEmpty()){
     emit NoRepoAvailable();
   }else{
     emit RepositoryInfoReady();
   }
}
void Application::run()
{
	sf::Clock clock;
	sf::Time timeSinceLastUpdate = sf::Time::Zero;

	while (window.isOpen())
	{
		sf::Time dt;
		dt = clock.restart();
		timeSinceLastUpdate += dt;
	
		while (timeSinceLastUpdate > timePerFrame)
		{
			timeSinceLastUpdate -= timePerFrame;

			getInput();
			update(timePerFrame);

			if (mStateStack.isEmpty())
			{
				close();
			}
		}

		updateStatistics(dt);
		render();		
	}
}
Example #17
0
void LogStatistics::setModel(AbstractLogModel *model)
{
    if (m_model)
    {
        disconnect(m_model, &AbstractLogModel::rowsInserted, this, &LogStatistics::updateStatistics);
        disconnect(m_model, &AbstractLogModel::rowsRemoved, this, &LogStatistics::updateStatistics);
        if (auto logModel = dynamic_cast<LogModel*>(model))
        {
            disconnect(logModel, &LogModel::clientConnected, this, &LogStatistics::updateStatistics);
            disconnect(logModel, &LogModel::clientDisconnected, this, &LogStatistics::updateStatistics);
        }
    }
    m_model = model;
    if (m_model)
    {
        connect(m_model, &AbstractLogModel::rowsInserted, this, &LogStatistics::updateStatistics);
        connect(m_model, &AbstractLogModel::rowsRemoved, this, &LogStatistics::updateStatistics);
        if (auto logModel = dynamic_cast<LogModel*>(model))
        {
            connect(logModel, &LogModel::clientConnected, this, &LogStatistics::updateStatistics);
            connect(logModel, &LogModel::clientDisconnected, this, &LogStatistics::updateStatistics);
        }
    }
    updateStatistics();
}
Example #18
0
LogStatistics::LogStatistics(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::LogStatistics),
    m_model(nullptr)
{
    ui->setupUi(this);
    updateStatistics();
}
Example #19
0
int main(int argc, char *argv[])
{
    if(argc<5) {
        printf("Error!! \nArguments :\n 1: file name with ONLY quality values\n 2: Length of the reads \n 3: Number of reads \n 4: Output file\n");
        return 1;
    }
    FILE *f;
    FILE *f1;
    int szReads;
    double **covariance;
    double *mean;
    double *tmpread;
    int ctr,ctr1;
    int numTotalReads;

    szReads = atoi(argv[2]);
    numTotalReads = atoi(argv[3]);
    //szReads = (int)argv[2];
    f = fopen(argv[1],"r");
    f1 = fopen(argv[4],"w");


    covariance = (double **) calloc(szReads, sizeof(double*));

    for (ctr = 0; ctr < szReads; ctr++) {
        covariance[ctr] = (double *) calloc(szReads, sizeof(double));
    }

    mean = (double *) calloc(szReads, sizeof(double));
    tmpread = (double *) calloc(szReads, sizeof(double));

    for (ctr = 0; ctr < numTotalReads; ctr++) {
        for (ctr1 = 0; ctr1 < szReads; ctr1++) {
            tmpread[ctr1] = (int) fgetc(f);
        }
        fgetc(f);
        updateStatistics(tmpread,mean,covariance,ctr, szReads);
    }
    for (ctr = 0; ctr < szReads; ctr++) {
        for (ctr1 = 0; ctr1 < szReads; ctr1++) {
            covariance[ctr][ctr1] = covariance[ctr][ctr1]-mean[ctr]*mean[ctr1];
        }
    }
    for (ctr = 0; ctr < szReads; ctr++) {
        for (ctr1 = 0; ctr1 < szReads; ctr1++) {
            fprintf(f1,"%f ",covariance[ctr][ctr1]);
        }
        fprintf(f1,"\n");
    }
    for (ctr = 0; ctr < szReads; ctr++) {
        fprintf(f1,"%f ",mean[ctr]);
    }
    fprintf(f1,"\n");

    fclose(f1);
    fclose(f);
    return 0;
}
Example #20
0
void PrimerGroupBox::sl_onPrimerChanged(const QString &primer) {
    if (PrimerStatistics::validate(primer) || primer.isEmpty() || annotatedDnaView == NULL) {
        updateStatistics(primer);
    } else {
        findPrimerAlternatives(primer);
    }

    emit si_primerChanged();
}
void SupportedProtocolsDialog::fillTree()
{
    void *proto_cookie;
    QList <QTreeWidgetItem *> proto_list;

    for (int proto_id = proto_get_first_protocol(&proto_cookie); proto_id != -1;
         proto_id = proto_get_next_protocol(&proto_cookie)) {
        protocol_t *protocol = find_protocol_by_id(proto_id);
        QTreeWidgetItem *proto_ti = new QTreeWidgetItem();
        proto_ti->setText(name_col_, proto_get_protocol_short_name(protocol));
        proto_ti->setText(filter_col_, proto_get_protocol_filter_name(proto_id));
        // type_col_ empty
        proto_ti->setText(descr_col_, proto_get_protocol_long_name(protocol));
        proto_ti->setData(name_col_, Qt::UserRole, proto_id);
        proto_list << proto_ti;
    }

    updateStatistics();
    ui->protoTreeWidget->invisibleRootItem()->addChildren(proto_list);
    ui->protoTreeWidget->sortByColumn(name_col_, Qt::AscendingOrder);

    foreach (QTreeWidgetItem *proto_ti, proto_list) {
        void *field_cookie;
        int proto_id = proto_ti->data(name_col_, Qt::UserRole).toInt();
        QList <QTreeWidgetItem *> field_list;
        for (header_field_info *hfinfo = proto_get_first_protocol_field(proto_id, &field_cookie); hfinfo != NULL;
             hfinfo = proto_get_next_protocol_field(proto_id, &field_cookie)) {
            if (hfinfo->same_name_prev_id != -1) continue;

            QTreeWidgetItem *field_ti = new QTreeWidgetItem();
            field_ti->setText(name_col_, hfinfo->name);
            field_ti->setText(filter_col_, hfinfo->abbrev);
            field_ti->setText(type_col_, ftype_pretty_name(hfinfo->type));
            field_ti->setText(descr_col_, hfinfo->blurb);
            field_list << field_ti;

            field_count_++;
            if (field_count_ % 1000 == 0) updateStatistics();
        }
        std::sort(field_list.begin(), field_list.end());
        proto_ti->addChildren(field_list);
    }
void AudioStatusBox::onServerStatusReply(int ugens, int synths, int groups, int synthDefs,
                                         float avgCPU, float peakCPU)
{
    m_avg_cpu = avgCPU;
    m_peak_cpu = peakCPU;
    m_ugens = ugens;
    m_synths = synths;
    m_groups = groups;
    m_synthdefs = synthDefs;

    updateStatistics();
}
Example #23
0
UIInfo::UIInfo(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::UIInfo)
{
    QString text;
    ui->setupUi(this);
    updateStatistics();
    uiPendingRequests = new UIPendingRequests(this);

    timer = new QTimer(this);
    timer->setInterval(3000);
    timer->setSingleShot(false);
    timer->start();

    text = ui->label_2->text();
#ifdef __DEBUG__
    text.replace("%%VERSION%%", "DEBUG");
#else
    text.replace("%%VERSION%%", PROGRAM_VERSION);
#endif
    text.replace("%%BUILDDATE%%", BUILDDATE);
    text.replace("%%QT_VERSION%%", QT_VERSION_STR);
    ui->label_2->setText(text);

    connect(timer, SIGNAL(timeout()), this, SLOT(updateStatistics()));
    connect(timer, SIGNAL(timeout()), this, SLOT(updateDebugInformation()));

    connect(ui->btnShowRequests, SIGNAL(clicked()), this, SLOT(showRequests()));
    connect(uiPendingRequests, SIGNAL(reloadRequested()), this, SLOT(reloadRequests()));
    connect(this, SIGNAL(rejected()), uiPendingRequests, SLOT(hide()));

    logFile = new QFile();
    logFile->setFileName("fourchan-dl.log");
    logFile->open(QIODevice::ReadOnly | QIODevice::Unbuffered | QIODevice::Text);

    if (logFile->isReadable()) {
        connect(timer, SIGNAL(timeout()), this, SLOT(updateLogFile()));
    }
}
Example #24
0
void
MSDevice_Tripinfo::generateOutput() const {
    const SUMOTime timeLoss = MSGlobals::gUseMesoSim ? myMesoTimeLoss : static_cast<MSVehicle&>(myHolder).getTimeLoss();
    updateStatistics(timeLoss);
    if (!OptionsCont::getOptions().isSet("tripinfo-output")) {
        return;
    }
    myPendingOutput.erase(this);
    double routeLength;
    SUMOTime duration;
    computeLengthAndDuration(routeLength, duration);

    // write
    OutputDevice& os = OutputDevice::getDeviceByOption("tripinfo-output");
    os.openTag("tripinfo").writeAttr("id", myHolder.getID());
    os.writeAttr("depart", time2string(myHolder.getDeparture()));
    os.writeAttr("departLane", myDepartLane);
    os.writeAttr("departPos", myHolder.getDepartPos());
    if (MSGlobals::gLateralResolution > 0) {
        os.writeAttr("departPosLat", myDepartPosLat);
    }
    os.writeAttr("departSpeed", myDepartSpeed);
    os.writeAttr("departDelay", time2string(myHolder.getDepartDelay()));
    os.writeAttr("arrival", time2string(myArrivalTime));
    os.writeAttr("arrivalLane", myArrivalLane);
    os.writeAttr("arrivalPos", myArrivalPos);
    if (MSGlobals::gLateralResolution > 0) {
        os.writeAttr("arrivalPosLat", myArrivalPosLat);
    }
    os.writeAttr("arrivalSpeed", myArrivalSpeed);
    os.writeAttr("duration", time2string(duration));
    os.writeAttr("routeLength", routeLength);
    os.writeAttr("waitingTime", time2string(myWaitingTime));
    os.writeAttr("waitingCount", myWaitingCount);
    os.writeAttr("stopTime", time2string(myStoppingTime));
    os.writeAttr("timeLoss", time2string(timeLoss));
    os.writeAttr("rerouteNo", myHolder.getNumberReroutes());
    const std::vector<MSDevice*>& devices = myHolder.getDevices();
    std::ostringstream str;
    for (std::vector<MSDevice*>::const_iterator i = devices.begin(); i != devices.end(); ++i) {
        if (i != devices.begin()) {
            str << ' ';
        }
        str << (*i)->getID();
    }
    os.writeAttr("devices", str.str());
    os.writeAttr("vType", myHolder.getVehicleType().getID());
    os.writeAttr("speedFactor", myHolder.getChosenSpeedFactor());
    os.writeAttr("vaporized", (myHolder.getEdge() == *(myHolder.getRoute().end() - 1) ? "" : "0"));
    // cannot close tag because emission device output might follow
}
Example #25
0
void Application::run() {
    // Launches the game
    sf::Clock clock;
    sf::Time timeSinceLastUpdate = sf::Time::Zero;

    while (mWindow.isOpen()) {
        sf::Time dt = clock.restart();
        timeSinceLastUpdate += dt;

        // While there are still time-steps that ought to have passed
        while (timeSinceLastUpdate > TimePerFrame) {
            timeSinceLastUpdate -= TimePerFrame;
            timeStep();
        }
        updateStatistics(dt);
        render();
    }
}
Example #26
0
void PongGame::run() {
    sf::Clock clock;
    sf::Time timeSinceLastUpdate = sf::Time::Zero;

    while (mainWindow.isOpen()) {
        processEvents();
        sf::Time elapsedTime = clock.restart();
        timeSinceLastUpdate += elapsedTime;
        while (timeSinceLastUpdate > timePerFrame) {
            timeSinceLastUpdate -= timePerFrame;
            processEvents();
            // no matter what happens, give the same  delta time to the update function
            update();
        }
        updateStatistics(elapsedTime);
        render();
    }
}
void App::run()
{
    sf::Clock clock;                                            //frame limiter
	sf::Time timeSinceLastUpdate = sf::Time::Zero;
	while (mWindow.isOpen())
	{
		sf::Time elapsedTime = clock.restart();
		timeSinceLastUpdate += elapsedTime;
		while (timeSinceLastUpdate > mTimePerFrame)             //keeping up with the input
		{
			timeSinceLastUpdate -= mTimePerFrame;

			handleEvents();
			update(mTimePerFrame);
		}

		updateStatistics(elapsedTime);
		render();                                               //final rendering
	}
}
Example #28
0
void Game::run()
{
    sf::Clock clock;
    sf::Time timeSinceLastUpdate = sf::Time::Zero;
    while (m_Window.isOpen())
    {
        sf::Time elapsedTime = clock.restart();
        timeSinceLastUpdate += elapsedTime;
        while (timeSinceLastUpdate > m_TimePerFrame)
        {
            timeSinceLastUpdate -= m_TimePerFrame;

            processEvents();
            update(m_TimePerFrame);
        }

        updateStatistics(elapsedTime);
        render();
    }
}
Example #29
0
void killDeadBugs(void) {
    int i = bug_list.size() - 1;
    /* Negative health kills bugs. */
    while (i >= 0) {
        /* Clear the square the bug occupied in the world if we are
         * the only one there.
         */
        if (bug_list[i].health <= 0) {
            updateStatistics(bug_list[i].genes);
            if (world[bug_list[i].x][bug_list[i].y] == i)
                world[bug_list[i].x][bug_list[i].y] = EMPTY;
            bug_list[i] = bug_list.back();
            if (i != bug_list.size() - 1) {
                world[bug_list.back().x][bug_list.back().y] = i;
            }
            bug_list.pop_back();
        }
        --i;
    }

}
Example #30
0
void Game::run()
{
	sf::Clock clock;
	sf::Time timeSinceLastUpdate = sf::Time::Zero;
	while (mWindow.isOpen())
	{
		sf::Time elapsedTime = clock.restart(); //Note restart returns the time on the clock then restarts the clock
		timeSinceLastUpdate += elapsedTime;
		while (timeSinceLastUpdate > TimePerFrame) //Ensures that the logic is caught up before rendering again
		{
			timeSinceLastUpdate -= TimePerFrame;

			processEvents();
			update(TimePerFrame);
		}

		updateStatistics(elapsedTime);
		render();
	}
	mWindow.close();
}