示例#1
0
//main loop is a seperate function so I can spawn it
int32 InCommsLoop(void *pDummy)
{
	
	LogWindow 	*pLogWindow;
	uint16  	iMessageLength, iMessageType;
	char 		*pMessage;
	int32		iBytesReceived;

	pLogWindow = (LogWindow *)pDummy;

	while(!pLogWindow->myNapster->Quit())
	{
		// hows about making Napster inherit from BNetEndpoint
		if(!pLogWindow->bSomeThingToSend)
		{
			if (pLogWindow->myNapster->bneNapsterServer.IsDataPending(100))
			{
				pLogWindow->myNapster->bneNapsterServer.Receive(&iMessageLength, 2);
				pLogWindow->myNapster->bneNapsterServer.Receive(&iMessageType, 2);
				pMessage = (char *)malloc(iMessageLength);
				iBytesReceived = 0;
				while(iBytesReceived != iMessageLength)  
				{
					iBytesReceived += pLogWindow->myNapster->bneNapsterServer.Receive(pMessage + iBytesReceived, iMessageLength - iBytesReceived);
				}	
				pMessage = (char *) realloc((char *)pMessage, (iMessageLength+1));
				*(pMessage + iMessageLength) = '\0';
				pLogWindow->ActOnMessage(iMessageType, iMessageLength, pMessage);
			}
		}
	}
	return(0);
}
示例#2
0
void LogWindowTest::run()
{
	while (!MainWindow::_instance)
		Sleep(500);
	auto& area = *MainWindow::instance().mdiArea;
	while (area.subWindowList().size() == 0)
		Sleep(1000);
	QMdiSubWindow *window = area.subWindowList().at(0);
		
	//area.setActiveSubWindow(window);
	LogWindow *logView = qobject_cast<LogWindow *>(window->widget());
	QTimer scrollTimer;
//	log_trace(0) << "thread" << currentThreadId();
	connect(this, &LogWindowTest::scrolltable, logView->mainView_.data(), [logView](QModelIndex index) {
//		log_trace(0) << "thread" << currentThreadId();
		logView->mainView_->scrollTo(index);
	});
			
	connect(&scrollTimer, &QTimer::timeout, this, [this, &logView]() {
		auto pos = rand() % 40000;
		auto model = logView->model();
		//QModelIndex index = model->currentIndex();
		auto index = logView->model()->index(pos, 0);
		//model->setCurrentIndex(index);
		emit scrolltable(index);
		//logView->_logView->scrollTo(index);
	});
	scrollTimer.start(100);
	exec();
}
示例#3
0
void WindowQt::debugActOpenLog()
{
	LogWindow* foo = new LogWindow(m_machine, this);
	// A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
	// foo->setWindowFlags(Qt::Dialog);
	// foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
	foo->show();
}
示例#4
0
void MainWindow::on_pushButtonUpdateMrks_clicked()
{
    qDebug() << Q_FUNC_INFO <<"start";

    //qDebug()<<"Testing getInblrMark (Student With mark) :";
    //qDebug() <<ui->wFitsbrowser->getInblrMark("200300154");
    //qDebug()<<"Testing getInblrMark (Student With empty mark) :";
    //qDebug() <<ui->wFitsbrowser->getInblrMark("200000844");

    //qDebug()<<"Testing setInblrMark (200300154 --> 40): " ;
    //ui->wFitsbrowser->setInblrMark("200300154",40);

    //qDebug()<<"Testing InblrContainsStuNum (200300154): Should be true: ";
    //qDebug()<<ui->wFitsbrowser->InblrContainsStuNum("200300154");

    //qDebug()<<"Testing InblrContainsStuNum (204063982): Should be false: ";
    //qDebug()<<ui->wFitsbrowser->InblrContainsStuNum("204063982");

    ui->labelProgress->show();

    QStringList stunumbers = csvInter.GetAllStudentNumbersPerMarkType( ui->comboBoxMarkTypeSlct->currentText() );

    LogWindow *UpdateMarksLog = new LogWindow();

    QStringList logErrors;
    QStringList logWarnings;
    QStringList logInformation;

    qDebug()<<"--- ITS Update trunc version ---";
    qDebug()<<"Updating marks";
    qDebug()<<QDateTime::currentDateTime().toString();
    qDebug()<<"File Name:" <<csvInter.FilePath();
    qDebug()<<"Mark Type: "<<ui->comboBoxMarkTypeSlct->currentText();
    qDebug()<<"";

   UpdateMarksLog->AddUpdateHeader( csvInter.FilePath(),ui->comboBoxMarkTypeSlct->currentText(),csvInter.GetSubjectCode() );


    foreach ( const QString snum,stunumbers )
    {
        qDebug()<<"Updating student number: "<<snum;

        if( !ui->wFitsbrowser->InblrContainsStuNum( snum ) ){

            logErrors.append( tr( "Student not found on Inabler: %1 No update made" ).arg( snum ) );
            qDebug()<<"Student "<<snum<< "not found on Inabler";
            qDebug()<<"MARK NOT UPDATED "<<snum;
        }else{

            int oldm = ui->wFitsbrowser->GetInblrMark(snum);
            QString oldMark;
            oldMark = tr("%1").arg(oldm);
            qDebug()<<"Old mark: ";
            qDebug()<< oldMark;
            qDebug()<<"New mark: ";
            int newmark = csvInter.GetStudentMarkPerMarkType(ui->comboBoxMarkTypeSlct->currentText(),snum);
            qDebug()<<newmark;

            if( oldm > newmark ){

                logWarnings.append( tr( "Student %3 Old mark ( %1 ) > ( %2 ) No update made" ).arg( oldMark ).arg( newmark ).arg( snum ) );
            }else{

            ui->wFitsbrowser->SetInblrMark( snum,newmark );

            logInformation.append(tr( "Mark Updated %3 : %1 --> %2" ).arg( oldMark ).arg( newmark ).arg( snum ) );
            }
        }

      qDebug()<<"";

    }
示例#5
0
void MainWindow::on_logButton_clicked()
{
    ConnectorPath  conPath( _connector, _curItemPath);
    LogWindow*  logWindow = new LogWindow( _appSettings, conPath, 0);
    logWindow->show();
}