bool CLoggingManager::updateLog(IEspLogEntry* entry, StringBuffer& status)
{
    if (entry->getLogContent())
        return updateLog(entry->getEspContext(), entry->getOption(), entry->getLogContent(), status);

    if (entry->getLogInfoTree())
        return updateLog(entry->getEspContext(), entry->getOption(), entry->getLogInfoTree(), entry->getExtraLog(), status);

    return updateLog(entry->getEspContext(), entry->getOption(), entry->getUserContextTree(), entry->getUserRequestTree(),
        entry->getBackEndReq(), entry->getBackEndResp(), entry->getUserResp(), entry->getLogDatasets(), status);
}
Exemplo n.º 2
0
void MainWindow::clickedPicture(QPoint pt)
{
    updateLog(QString("clicked %1 %2").arg(pt.x()).arg(pt.y()));
    std::vector<cv::Point2f> corner(1, cv::Point2f(pt.x(), pt.y()));

    cv::Mat gray;
    cvtColor(latestMatImage, gray, CV_BGR2GRAY);


    cv::cornerSubPix(gray, corner, cv::Size(5, 5), cv::Size(-1, -1), cv::TermCriteria(2, 0, 0.001));
    qDebug() << "corner";
    updateLog(QString("subpixel pos %1 %2").arg(corner[0].x).arg(corner[0].y));
}
Exemplo n.º 3
0
void StatusThread::run()
{
	emit textAppend1("Paradigm begins");
	emit textAppend1("...");
	QDateTime time;
	while (true) {
		QList<QFileInfo> listEDAT2 = e->getDir().entryInfoList(QStringList(e->getFi().baseName() + "-*-*.edat2"), QDir::Files);
		QList<QFileInfo> listTXT = e->getDir().entryInfoList(QStringList(e->getFi().baseName() + "-*-*.txt"), QDir::Files);
		qDebug() << QStringList(e->getFi().baseName() + "-*-*.edat2").size();
		qDebug() << QStringList(e->getFi().baseName() + "-*-*.txt").size();
		msleep(1000);
		QMutexLocker locker(&mutex);
		qDebug() << "keep Monitoring";
		if (listEDAT2.size() != 0) {
			threadFlag = false;
			if (copyLogFiles(listEDAT2, listTXT))
				qDebug() << "log copied succeeded";
			else
				qDebug() << "log copied failed";

		}
		if (listTXT.size() != 0) {
			qDebug() << listTXT[0].lastModified();
			if(updateLog(listTXT, time))
				qDebug() << time;
		}
		if (!threadFlag)	break;

	}

	emit textAppend1("Paradigm ends");
}
Exemplo n.º 4
0
LogDialog::LogDialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::LogDialog)
    , m_showError(true)
    , m_showWarning(true)
    , m_showNote(true)
    , m_showDebug(true)
    , m_showTrace(true)
{
    ui->setupUi(this);

    auto font = ui->textBrowserLog->font();
    font.setFamily("Monospace");
    ui->textBrowserLog->setFont(font);

    m_logDecorator = new LogDecorator(font, this);
    m_stringDecorator = new StringDecorator(this);
    m_threadNameDecorator = new ThreadNameDecorator(font, this);

    ui->labelLogFileName->setText(logFileName());

    addFilterCheckBox(LogError, &LogDialog::showError);
    addFilterCheckBox(LogWarning, &LogDialog::showWarning);
    addFilterCheckBox(LogNote, &LogDialog::showNote);
    addFilterCheckBox(LogDebug, &LogDialog::showDebug);
    addFilterCheckBox(LogTrace, &LogDialog::showTrace);
    ui->layoutFilters->addStretch(1);

    updateLog();
}
Exemplo n.º 5
0
void IAS_acknowledgeIssues(UINT8 ID)
{
	UINT8 i;
	ias.issues[ID].ackStatus = 0;

	updateLog(ias.issues[ID].data);

	


	Write_b_eep((ID*ISSUE_ENTRY_SIZE)+ISSUE_ACKSTATUS, ias.issues[ID].ackStatus);
	Busy_eep();
	ClrWdt();

	//IAS_updateIssues(ias.issues[ID].data);

	for( i = 0 ; i < MAX_ISSUES ;i++)
	{
		if( ias.issues[i].ackStatus == 1)
			return;
	}
	BUZ_OP = 0;
			
	
}
Exemplo n.º 6
0
void EkosManager::appendLogText(const QString &text)
{

    logText.insert(0, i18nc("log entry; %1 is the date, %2 is the text", "%1 %2", QDateTime::currentDateTime().toString("yyyy-MM-ddThh:mm:ss"), text));

    updateLog();
}
void BuiltinSchedulerPlugin::slotFinished( SchedulerThread *job )
{
    ScheduleManager *sm = job->mainManager();
    Project *mp = job->mainProject();
    qDebug()<<"BuiltinSchedulerPlugin::slotFinished:"<<mp<<sm<<job->isStopped();
    if ( job->isStopped() ) {
        sm->setCalculationResult( ScheduleManager::CalculationCanceled );
    } else {
        updateLog( job );
        Project *tp = static_cast<KPlatoScheduler*>( job )->project();
        ScheduleManager *tm = static_cast<KPlatoScheduler*>( job )->manager();
        updateProject( tp, tm, mp, sm );
        sm->setCalculationResult( ScheduleManager::CalculationDone );
    }
    sm->setScheduling( false );

    m_jobs.removeAt( m_jobs.indexOf( job ) );
    if ( m_jobs.isEmpty() ) {
        m_synctimer.stop();
    }
    emit sigCalculationFinished( mp, sm );

    disconnect(this, SIGNAL(sigCalculationStarted(Project*, ScheduleManager*)), mp, SIGNAL(sigCalculationStarted(Project*, ScheduleManager*)));
    disconnect(this, SIGNAL(sigCalculationFinished(Project*, ScheduleManager*)), mp, SIGNAL(sigCalculationFinished(Project*, ScheduleManager* )));

    job->deleteLater();
    qDebug()<<"BuiltinSchedulerPlugin::slotFinished: <<<";
}
Exemplo n.º 8
0
void EkosManager::initFocus()
{
    if (focusProcess)
        return;

    focusProcess = new Ekos::Focus();
    toolsWidget->addTab( focusProcess, i18n("Focus"));
    connect(focusProcess, SIGNAL(newLog()), this, SLOT(updateLog()));

}
Exemplo n.º 9
0
void EkosManager::initCapture()
{
    if (captureProcess)
        return;

     captureProcess = new Ekos::Capture();
     toolsWidget->addTab( captureProcess, i18n("CCD"));
     connect(captureProcess, SIGNAL(newLog()), this, SLOT(updateLog()));

}
Exemplo n.º 10
0
void ReceiverThread::logTransmit(uint8_t packet[], uint8_t length)
{
	QString text("Transmitted: ");
	for(int i=0; i<length; i++) {
		uint8_t character = packet[i];
		text += QString("%1 ").arg(character, 2, 16, QLatin1Char('0'));
	}

	updateLog(text);
}
Exemplo n.º 11
0
void APP_raiseIssues(far UINT8* data)
{
	UINT8 i,j,issueIndex;
	UINT8 *ptr;



	for(i = 0; i < MAX_ISSUES; i++)										//for each issue
		if(ias.issues[i].state != ISSUE_RESOLVED )						//if it is raised
			if(strcmp((INT8*)data,(INT8 *)ias.issues[i].data) == 0)		//if input matches				
					return;												//do nothing


	for( i = 0 ; i < MAX_ISSUES ;i++)
	{
		if( ias.issues[i].state == ISSUE_RESOLVED )
		{
			ias.issues[i].state = ISSUE_RAISED;
			ias.issues[i].timeout =  timeout;
			ias.issues[i].ackStatus = 1;
			strcpy((INT8*) ias.issues[i].data, (INT8*)data);

			ptr = (UINT8*)&ias.issues[i];
			for(j = 0; j < ISSUE_ENTRY_SIZE; j++)
			{
				Write_b_eep(j+(i*ISSUE_ENTRY_SIZE),*(ptr+j));
				Busy_eep();
				ClrWdt();
			}

			ias.issues_raised++;
            if(ias.issues_critical == 0)
            {
				if(	ias.mutualAid == 1 )
				  	updateIndication(-1,1,0,0);
				else				
			  		updateIndication(0,1,0,0);
            }
            else
            {
				if( ias.mutualAid == 1)
			  		updateIndication(-1,1,1,0);
				else
					updateIndication(0,1,1,0);
			}
			updateLog(data);
			break;
		}
	}

	if( ias.issues_critical ==  0 )
		ias.state = ISSUE_RAISED;


}
void
MultiShot::finishSeq()
{
    updateLog( false );
    inProgress = false;
    stopButton->setEnabled( false );
    runButton->setEnabled( true );
    tabWidget->setEnabled( true );
    // show all compensations once again
    eCompensation->updateExposures( eFrames->value() );
}
void
MultiShot::startSeq()
{
    // only show current compensation
    eCompensation->updateExposures( 0 );
    tabWidget->setEnabled( false );
    runButton->setEnabled( false );
    stopButton->setEnabled( true );
    inProgress = true;
    updateLog( true );
    emit startSequence( shotSeq );
}
Exemplo n.º 14
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    ui.setupUi(this);
    ui.graphicsView->setScene(&scene);


    cameraHandler = new CameraHandler(this);
   // connect(cameraHandler, SIGNAL(displayImage(QImage)), SLOT(displayImage(QImage)));
    connect(cameraHandler, SIGNAL(updateLog(QString)), ui.plainTextEdit, SLOT(appendPlainText(QString)));
    connect(this, SIGNAL(updateLog(QString)), ui.plainTextEdit, SLOT(appendPlainText(QString)));
    cameraHandler->init();
    picItem = new ClickablePixmapItem;
    picItem->setScale(0.5);
    scene.addItem(picItem);
    connect(picItem, SIGNAL(clickedPt(QPoint)), this, SLOT(clickedPicture(QPoint)));
    fd = new FiducialDetector(this);
    connect(fd, SIGNAL(updateLog(QString)), ui.plainTextEdit, SLOT(appendPlainText(QString)));
    fd->saveIntermediatePictures(true);

}
Exemplo n.º 15
0
void MainWindow::on_pushButtonLoadPicture_clicked()
{
    QString f = QFileDialog::getOpenFileName(this, "Select picture filename");
    if (f != "")
    {
        picItem->setPixmap(QPixmap(f));
    }
    latestMatImage = cv::imread(f.toAscii().constData());
    cv::Size size = latestMatImage.size();

    updateLog(QString("ImageMat size %1 %2").arg(size.width).arg(size.height));
}
Exemplo n.º 16
0
int Window::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: updateLog((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
Exemplo n.º 17
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);
}
Exemplo n.º 18
0
void ReceiverThread::logReceive()
{
	QString text("Received: ");
	text += QString("%1 ").arg(0x10, 2, 16, QLatin1Char('0'));
	text += QString("%1 ").arg(address, 2, 16, QLatin1Char('0'));
	text += QString("%1 ").arg(command, 2, 16, QLatin1Char('0'));
	for(int idx=0; idx<length; idx++) {
		uint8_t character = data[idx];
		text += QString("%1 ").arg(character, 2, 16, QLatin1Char('0'));
	}
	text += QString("%1").arg(checksum, 2, 16, QLatin1Char('0'));
	
	updateLog(text);
}
bool CLoggingManager::updateLog(IEspContext* espContext, IEspUpdateLogRequestWrap& req, IEspUpdateLogResponse& resp, StringBuffer& status)
{
    bool bRet = updateLog(espContext, req, resp);
    if (bRet)
        status.set("Log request has been sent.");
    else
    {
        const char* statusMsg = resp.getStatusMessage();
        if (statusMsg && *statusMsg)
            status.setf("Failed to update log: %s", statusMsg);
        else
            status.set("Failed to update log");
    }
    return bRet;
}
Exemplo n.º 20
0
void EkosManager::initGuide()
{    
    if (guideProcess == NULL)
        guideProcess = new Ekos::Guide();

    if (guider && guider->isConnected() && useST4 && guideStarted == false)
    {
        guideStarted = true;
        if (scope && scope->isConnected())
            guideProcess->setTelescope(scope);

        toolsWidget->addTab( guideProcess, i18n("Guide"));
        connect(guideProcess, SIGNAL(newLog()), this, SLOT(updateLog()));

    }
}
Exemplo n.º 21
0
void EkosManager::clearLog()
{
    QWidget *currentWidget = toolsWidget->currentWidget();

    if (currentWidget == setupTab)
    {
        logText.clear();
        updateLog();
    }
    else if (currentWidget == captureProcess)
        captureProcess->clearLog();
    else if (currentWidget == focusProcess)
        focusProcess->clearLog();
    else if (currentWidget == guideProcess)
        guideProcess->clearLog();

}
bool CLoggingManager::updateLog(IEspContext* espContext, const char* option, IPropertyTree* userContext, IPropertyTree* userRequest,
    const char* backEndReq, const char* backEndResp, const char* userResp, const char* logDatasets, StringBuffer& status)
{
    if (!initialized)
        throw MakeStringException(-1,"LoggingManager not initialized");

    bool bRet = false;
    try
    {
        Owned<IPropertyTree> espContextTree;
        if (espContext)
        {
            espContextTree.setown(createPTree("ESPContext"));

            short port;
            StringBuffer sourceIP, peerStr;
            const char* esdlBindingID = espContext->queryESDLBindingID();
            espContext->getServAddress(sourceIP, port);
            espContextTree->addProp("SourceIP", sourceIP.str());
            espContext->getPeer(peerStr);
            espContextTree->addProp("Peer", peerStr.str());
            if (!isEmptyString(esdlBindingID))
                espContextTree->addProp("ESDLBindingID", esdlBindingID);
            //More information in espContext may be added to the espContextTree later.

            const char* userId = espContext->queryUserId();
            if (userId && *userId)
                espContextTree->addProp("UserName", userId);

            espContextTree->addProp("ResponseTime", VStringBuffer("%.4f", (msTick()-espContext->queryCreationTime())/1000.0));
        }
        Owned<IEspUpdateLogRequestWrap> req =  new CUpdateLogRequestWrap(nullptr, option, espContextTree.getClear(), LINK(userContext), LINK(userRequest),
            backEndReq, backEndResp, userResp, logDatasets);
        Owned<IEspUpdateLogResponse> resp =  createUpdateLogResponse();
        bRet = updateLog(espContext, *req, *resp, status);
    }
    catch (IException* e)
    {
        status.set("Failed to update log: ");
        e->errorMessage(status);
        ERRLOG("%s", status.str());
        e->Release();
    }
    return bRet;
}
Exemplo n.º 23
0
BOOL IAS_logout(far UINT8 *password,far UINT8 *data)
{
	UINT8 grn =0 ,org = 0,red = 0,buz = 0; 
	UINT8 i;
	if( strcmp(ias.logonPassword , password) )
		return FALSE;


	updateIndication(grn,org,red,buz);

	updateLog(data);
/*
	Write_b_eep(LOGON_STATUS, 0);
	Busy_eep();
	ClrWdt();
*/
	ias.logonStatus = 0;
	return TRUE;
}
bool CLoggingManager::updateLog(IEspContext* espContext, const char* option, IPropertyTree* logInfo, IInterface* extraLog, StringBuffer& status)
{
    if (!initialized)
        throw MakeStringException(-1,"LoggingManager not initialized");

    bool bRet = false;
    try
    {
        Owned<IEspUpdateLogRequestWrap> req =  new CUpdateLogRequestWrap(nullptr, option, LINK(logInfo), LINK(extraLog));
        Owned<IEspUpdateLogResponse> resp =  createUpdateLogResponse();
        bRet = updateLog(espContext, *req, *resp, status);
    }
    catch (IException* e)
    {
        status.set("Failed to update log: ");
        e->errorMessage(status);
        ERRLOG("%s", status.str());
        e->Release();
    }

    return bRet;
}
Exemplo n.º 25
0
void MainWindow::createActions()
{
	// Open
	m_newAction = StandardAction::openNew(this, SLOT(newFile()), this);
	m_openAction = StandardAction::open(this, SLOT(open()), this);
	m_openRecentAction = StandardAction::openRecent(this, SLOT(loadUrl(Url)), this);
	m_saveAction = StandardAction::save(this, SLOT(save()), this);
	m_saveAsAction = StandardAction::saveAs(this, SLOT(saveAs()), this);
	m_reloadAction = new Action(Icon(QLatin1String("view-refresh")), tr("Reloa&d"), this, QLatin1String("file_reload"));
	m_reloadAction->setShortcut(QKeySequence::Refresh);
	m_reloadAction->setStatusTip(tr("Reload the current document"));
	m_reloadAction->setWhatsThis(tr("<p>Reload the current document from disk.</p>"));
	connect(m_reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
	m_closeAction = StandardAction::close(this, SLOT(closeFile()), this);
	m_exitAction = StandardAction::quit(this, SLOT(close()), this);

	m_newAction->setStatusTip(tr("Create a new document"));
	m_openAction->setStatusTip(tr("Open an existing file"));
	m_openRecentAction->setStatusTip(tr("Open a recently opened file"));
	m_saveAction->setStatusTip(tr("Save the current document to disk"));
	m_saveAsAction->setStatusTip(tr("Save the document under a new name"));
	m_closeAction->setStatusTip(tr("Close the current document"));
	m_exitAction->setStatusTip(tr("Exit the application"));

	m_newAction->setWhatsThis(tr("<p>Create a new document.</p>"));
	m_openAction->setWhatsThis(tr("<p>Open an existing file.</p>"));
	m_openRecentAction->setWhatsThis(tr("<p>Open a recently opened file.</p>"));
	m_saveAction->setWhatsThis(tr("<p>Save the current document to disk.</p>"));
	m_saveAsAction->setWhatsThis(tr("<p>Save the document under a new name.</p>"));
	m_closeAction->setWhatsThis(tr("<p>Close the current document.</p>"));
	m_exitAction->setWhatsThis(tr("<p>Exit the application.</p>"));

	// View
	m_buildAction = new Action(Icon(QLatin1String("run-build")), tr("&Build"), this, QLatin1String("build"));
	m_buildAction->setShortcut(tr("Ctrl+B", "View|Build"));
	m_buildAction->setStatusTip(tr("Build preview"));
	m_buildAction->setWhatsThis(tr("<p>Generate preview by building the current TikZ code in the editor.</p>"));
	connect(m_buildAction, SIGNAL(triggered()), m_tikzPreviewController, SLOT(regeneratePreview()));

	m_viewLogAction = new Action(Icon(QLatin1String("run-build-file")), tr("View &Log"), this, QLatin1String("view_log"));
	m_viewLogAction->setStatusTip(tr("View log messages produced by the last executed process"));
	m_viewLogAction->setWhatsThis(tr("<p>Show the log messages produced by the last executed process in the Messages box.</p>"));
	connect(m_viewLogAction, SIGNAL(triggered()), this, SLOT(updateLog()));

	// Configure
	m_configureAction = StandardAction::preferences(this, SLOT(configure()), this);
	m_configureAction->setText(tr("&Configure %1...").arg(KtikzApplication::applicationName()));
	m_configureAction->setStatusTip(tr("Configure the settings of this application"));
	m_configureAction->setWhatsThis(tr("<p>Configure the settings of this application.</p>"));

#ifdef KTIKZ_USE_KDE
	addActionCloneToCollection(QLatin1String("toggle_preview"), m_previewDock->toggleViewAction());
	addActionCloneToCollection(QLatin1String("toggle_log"), m_logDock->toggleViewAction());
#endif

	// Help
	m_showTikzDocAction = new Action(Icon(QLatin1String("help-contents")), tr("TikZ &Manual"), this, QLatin1String("show_tikz_doc"));
	m_showTikzDocAction->setStatusTip(tr("Show the manual of TikZ and PGF"));
	m_showTikzDocAction->setWhatsThis(tr("<p>Show the manual of TikZ and PGF.</p>"));
	connect(m_showTikzDocAction, SIGNAL(triggered()), this, SLOT(showTikzDocumentation()));

#ifdef KTIKZ_USE_KDE
	m_whatsThisAction = KStandardAction::whatsThis(this, SLOT(toggleWhatsThisMode()), this);
#else
	m_helpAction = new QAction(Icon(QLatin1String("help-contents")), tr("%1 &Handbook").arg(KtikzApplication::applicationName()), this);
	m_helpAction->setStatusTip(tr("Show the application's documentation"));
	m_helpAction->setShortcut(QKeySequence::HelpContents);
	connect(m_helpAction, SIGNAL(triggered()), this, SLOT(showDocumentation()));

	m_whatsThisAction = QWhatsThis::createAction(this);
	m_whatsThisAction->setIcon(Icon(QLatin1String("help-contextual")));
	m_whatsThisAction->setStatusTip(tr("Show simple description of any widget"));

	m_aboutAction = new QAction(QIcon(QLatin1String(":/icons/qtikz-22.png")), tr("&About %1").arg(KtikzApplication::applicationName()), this);
	m_aboutAction->setStatusTip(tr("Show the application's About box"));
	connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(about()));

	m_aboutQtAction = new QAction(QIcon(QLatin1String(":/icons/qt-logo-22.png")), tr("About &Qt"), this);
	m_aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
	connect(m_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
#endif
}
Exemplo n.º 26
0
void MainWindow::init()
{
	// Log
	connect(this, SIGNAL(logUpdated(QString)), this, SLOT(updateLog(QString)));

	enableCtrls(false);

	for (int i = DOCK_SNAP; i <= DOCK_PCB; i ++)
		initSnap(i);

	for (int i = DOCK_HISTORY; i <= DOCK_COMMAND; i ++)
		initHistory(i);

	ipsUI->init();

	// must call optUtils->init() after win, before show()
	optUtils->init();

#ifdef Q_OS_WIN
	//fixme: win font hack
	if (language.startsWith("zh_") || language.startsWith("ja_"))
	{
		QFont font;
		font.setFamily("MS Gothic");
		font.setFixedPitch(true);
		tbCommand->setFont(font);
//		tbCommand->setLineWrapMode(QTextEdit::NoWrap);
	}

	//rearrange docks
	addDockWidget(static_cast<Qt::DockWidgetArea>(Qt::LeftDockWidgetArea), m1UI);
	tabifyDockWidget(dwFolderList, m1UI);
#endif /* Q_OS_WIN */
	tabifyDockWidget(dwHistory, dwGUILog);

	//hide non popular docks by default
	dwGUILog->hide();

	for (int i = DOCK_SNAP; i < DOCK_LAST; i ++)
	{
		if (i != DOCK_SNAP
		 && i != DOCK_TITLE
		 && i != DOCK_HISTORY
		 && i != DOCK_MAMEINFO)
			dockCtrls[i]->hide();
	}

	dwFolderList->raise();
	dockCtrls[DOCK_SNAP]->raise();
	dockCtrls[DOCK_HISTORY]->raise();

	/* test ini readable/writable */
	// mkdir for individual game settings
	QDir().mkpath(CFG_PREFIX);

	QString warnings = "";
	QFile iniFile(CFG_PREFIX + "mamepgui" INI_EXT);
	if (!iniFile.open(QIODevice::ReadWrite | QFile::Text))
		warnings.append(QFileInfo(iniFile).absoluteFilePath());
	iniFile.close();

	if (warnings.size() > 0)
	{
		poplog("Current user has no sufficient privilege to read/write:\n" + warnings + "\n\ncouldn't save GUI settings.");
		//quit the program
		close();
		return;
	}

	loadGuiSettings();
	
	if (!validateMameBinary())
	{
			//quit the program
			close();
			return;
	}

	QIcon mamepIcon(":/res/mamep_256.png");
	qApp->setWindowIcon(mamepIcon);
	trayIcon = new QSystemTrayIcon(this);
	trayIcon->setIcon(mamepIcon);

	// must init app style before background
	if (gui_style.isEmpty())
		gui_style = pGuiSettings->value("gui_style").toString();

	QStringList styles = QStyleFactory::keys();
	QActionGroup *styleActions = new QActionGroup(this);
	foreach (QString style, styles)
	{
		QAction* act = menuGUIStyle->addAction(style);
		act->setCheckable(true);
		if (gui_style == style)
			act->setChecked(true);
		styleActions->addAction(act);
		connect(act, SIGNAL(triggered()), this, SLOT(setGuiStyle()));
	}
Exemplo n.º 27
0
/* Функция компиляци
 * Осуществляется как проверки, так и вызовв других
 * функций для проверок или преобразваний.
 * Проверки на правельность написания мнемокода ассамблера
 * и заменна мнемокода на коды команд, так же замена символов
 * адресации на коды адресации, и также меток на их дресса
 * - Входные данные: исходные мнемокод ассамблера с виджета
 * - Выходные данные: записать данных в ячейки ОЗУ сформированных
 * во время выполнения функции
 */
void Compiler::exec(QString &strSource)
{
  if(strSource.isEmpty()) return;
  QTime startTime = QTime::currentTime();

  strSource = parseLabel(strSource);
  QStringList slCommandPair = strSource.split(" ");

  mBar->setStyleSheet("QProgressBar {border: 1px solid rgb(83, 83, 83);background-color: rgb(38, 40, 41);border-radius: 5px;} QProgressBar::chunk {background-color: rgb(64, 66, 68);width: 20px; }");
  mBar->setMaximum(slCommandPair.size() - 1);
  mBar->setValue(0);

  QStringList debugList;
  QString isRegistr, strCode, strCmd, strArg = "000", typeAdrr = "0",
          debugArg = " ", debugCmd = " ", resParseCmd = "", error = "";

  int indexCmd = 0;
  for(int i = 0; i < slCommandPair.size(); i ++, mBar->setValue(i)) {
    strCmd = slCommandPair.at(i);
    debugCmd = slCommandPair.at(i);
    strCmd = strCmd.toLower();
    resParseCmd = parseSpecialCommand(strCmd,
                                      i + 1 < slCommandPair.size() ?
                                      slCommandPair.at(i + 1) : " ",
                                      error);
    qDebug() <<"ParseCmd: " << resParseCmd;
    if(resParseCmd != "-1" && error.isEmpty()) {
      mMemory->set(indexCmd, resParseCmd);
      debugList.append(strCmd);
      indexCmd ++;
    } else if(!error.isEmpty()) {
      fireError(error, indexCmd); return;
    } else {
      if(i < slCommandPair.size()) {
        if(i + 1 < slCommandPair.size()) {
          isRegistr = slCommandPair.at(i + 1);
          strCode = isRegistr.contains('r') || isRegistr.contains('R') ?
                    mGenCode->getCode(strCmd + "R") : mGenCode->getCode(strCmd);
        } else {
          fireError("нет аргумента для команды: " +  strCmd, indexCmd); return;
        }
      } else {
        fireError("нет аргумента для команды: " +  strCmd, indexCmd); return;
      }

      if(strCode != "-1") {
        if((i + 1) < slCommandPair.size() ) {
          if(mGenCode->getCode(slCommandPair.at(i + 1)) == "-1") {
            i ++;
            strArg = slCommandPair.at(i); debugArg = strArg;
            parseArguments(strArg, typeAdrr);
          } else {
            fireError("не верный аргумент команды: " +  strCmd, indexCmd); return;
          }
        } else {
          fireError("нет аргумента для команды: " +  strCmd, indexCmd); return;
        }

        while(strArg.size() < 3) strArg.push_front("0");
        strArg = strArg.replace('r', '0');

        debugList.append(debugCmd + " " + debugArg);
        mMemory->set(indexCmd, strCode + typeAdrr + strArg);
        indexCmd ++;
      } else {
        if(out) {
          fireError(" не верная команда", indexCmd);return;
        }
      }
    }
  }
  updateLog(startTime);
  mDpanel->updateCode(debugList);
}
Exemplo n.º 28
0
void resolveIssue(far UINT8* data)
{
	UINT8 i,j,issueIndex;
	UINT8 *ptr;
	if( data[2] == '0')
	{
		updateLog(data);
		return;
	}



	for(i = 0; i < MAX_ISSUES; i++)										//for each issue
		if(ias.issues[i].state != ISSUE_RESOLVED )						//if it is raised
			if(strcmp((INT8*)data,(INT8 *)ias.issues[i].data) == 0)		//if input matches
				if(ias.issues[i].ackStatus == 1) 						//check whether acknowledged
					return;												//if not return


	switch(ias.state)
	{
	

		case ISSUE_RAISED:

		for(i = 0; i< MAX_ISSUES ; i++)
		{
			issueIndex = issueResolved(data);
			if(  issueIndex != -1)
			{
				//updateLog(data);
				memset(ias.issues[issueIndex].data , 0 , MAX_KEYPAD_ENTRIES + 1);
							
				ClrWdt();
				
				ptr = (UINT8*)&ias.issues[issueIndex];
				for( j = 0; j < ISSUE_ENTRY_SIZE; j++)
				{
					Write_b_eep(j+(issueIndex*ISSUE_ENTRY_SIZE),*(ptr+j));
					Busy_eep();
					
					ClrWdt();
				}
				
				
				if(ias.issues_raised == 0)
				{
					ias.state = ISSUE_RESOLVED;
	
					updateIndication(1,0,0,0);
				}
				return;
			}
		}

		
	


		break;

		case ISSUE_CRITICAL:

		for(i = 0; i< MAX_ISSUES ; i++)
		{
			issueIndex = issueResolved(data);
			if(  issueIndex != -1)
			{
				//updateLog(data);
				memset(ias.issues[issueIndex].data , 0 , MAX_KEYPAD_ENTRIES + 1);
							
				ClrWdt();
				
				ptr = (UINT8*)&ias.issues[issueIndex];
				for( j = 0; j < ISSUE_ENTRY_SIZE; j++)
				{
					Write_b_eep(j+(issueIndex*ISSUE_ENTRY_SIZE),*(ptr+j));
					Busy_eep();
					
					ClrWdt();
				}
				
				
				if(ias.issues_critical == 0)
				{
				   	if(ias.issues_raised == 0)
					{
						ias.state = ISSUE_RESOLVED;
						updateIndication(1,0,0,0);
					}
					else
					{
						ias.state = ISSUE_RAISED;
						updateIndication(0,1,0,0);
					}
				}
				else
				
				{
                    if(ias.issues_raised == 0)
					{
					//	ias.state = ISSUE_RESOLVED;
						updateIndication(0,0,1,0);
					}
					else
					{
						//ias.state = ISSUE_RAISED;
						updateIndication(0,1,1,0);
					}
				
     			}                            
				return;
			}
		}

		break;

		default:
		break;

	}

}
Exemplo n.º 29
0
BitSplit::BitSplit()
{
    fontDb.addApplicationFont(":/fonts/OpenSans-Light.ttf");
    fontDb.addApplicationFont(":/fonts/OpenSans-Regular.ttf");
    exit = true;
    blockToggle = false;
    searchExisting = false;

    /* Timer setup*/
    guiUpdater  = new QTimer( this );
    guiUpdater->setInterval(25);

    syncAnimator  = new QTimer( this );
    syncAnimator->setInterval(75);

    /* Interface setup */
    fileInterface.debug = false;
    fileInterface.copyDirection = BothDirections;
    actionCreator.fileInterface = &fileInterface;
    smartMatch.fileInterface = &fileInterface;
    actionHandler.fileInterface = &fileInterface;
    updater.fileInterface = &fileInterface;

    /* Set up icons */
    remove  = new QIcon(":images/general/remove.png");

    done    = new QIcon(":images/table/tick.png");
    errorIcon   = new QIcon(":images/table/error.png");
    skip    = new QIcon(":images/table/skip.png");

    sync1   = new QIcon(":images/table/sync1.png");
    syncAnimation.append(sync1);
    sync2   = new QIcon(":images/table/sync2.png");
    syncAnimation.append(sync2);
    sync3   = new QIcon(":images/table/sync3.png");
    syncAnimation.append(sync3);
    sync4   = new QIcon(":images/table/sync4.png");
    syncAnimation.append(sync4);
    sync5   = new QIcon(":images/table/sync5.png");
    syncAnimation.append(sync5);
    sync6   = new QIcon(":images/table/sync6.png");
    syncAnimation.append(sync6);
    sync7   = new QIcon(":images/table/sync7.png");
    syncAnimation.append(sync7);
    sync8   = new QIcon(":images/table/sync8.png");
    syncAnimation.append(sync8);


    ui.setupUi( this );
    ui.runButton->setDisabled(true);

    /* Connect buttons to their dialogs */
    connect(ui.editSettingsButton,  SIGNAL(clicked()),  this,   SLOT(editSettings()));
    connect(ui.newProfileButton,    SIGNAL(clicked()),  this,   SLOT(newProfile()));


    /* Log Connections*/
    connect(ui.actionView_Log,  SIGNAL(triggered()),        this,       SLOT(showLog()));
    connect(ui.exitLog,         SIGNAL(clicked()),          this,       SLOT(showMain()));
    connect(&fileInterface,     SIGNAL(updateLog(QString)), ui.log,     SLOT(append(QString)));
    connect(ui.errorViewLog,    SIGNAL(clicked()),          this,       SLOT(showLog()));

    /* Top Bar connections*/
    connect(&fileInterface, SIGNAL(matchComplete()),            this,               SLOT(matchComplete()));
    connect(&fileInterface, SIGNAL(updateSingle(QString)),      ui.topBarSingle,    SLOT(setText(QString)));
    connect(&fileInterface, SIGNAL(updateTopMP(QString)),       ui.mp_top,          SLOT(setText(QString)));
    connect(&fileInterface, SIGNAL(updateBottomMP(QString)),    ui.mp_bottom,       SLOT(setText(QString)));
    connect(&fileInterface, SIGNAL(updateOperationMP(QString)), ui.mp_operation,    SLOT(setText(QString)));
    connect(guiUpdater,     SIGNAL(timeout()),                  &smartMatch,        SLOT(updateGuiLabels()));
    connect(&smartMatch,    SIGNAL(startTime()),                guiUpdater,         SLOT(start()));
    connect(&smartMatch,    SIGNAL(stopTime()),                 guiUpdater,         SLOT(stop()));
    connect(&smartMatch,    SIGNAL(setTopBarLineStack(int)),    this,               SLOT(setTopBarLineStack(int)));

    /* Unmatched files tree Connections */
    connect(ui.unmatchedTree,   SIGNAL(itemChanged(QTreeWidgetItem*,int)),  this,   SLOT(toggleTree(QTreeWidgetItem*,int)));
    connect(&fileInterface,     SIGNAL(updateFileTree(bool, QTreeWidgetItem *)), this, SLOT(insertTreeItem(bool, QTreeWidgetItem *)));
    connect(&fileInterface,     SIGNAL(pop()),                              this,   SLOT(popParent()));
    connect(&fileInterface,     SIGNAL(expandTree()), this, SLOT(expandTree()));

    /* Matched Table Connections */
    connect(&fileInterface, SIGNAL(insertMatchTableRow(QList<QTableWidgetItem*>*)), this, SLOT(insertMatchTableRow(QList<QTableWidgetItem*>*)));

    /* Action Table Connections*/
    connect(&fileInterface, SIGNAL(insertActionTableRow(QList<QTableWidgetItem*>*)), this, SLOT(insertActionTableRow(QList<QTableWidgetItem*>*)));

    /* Error connections */
    connect(&smartMatch,    SIGNAL(operationFailed()),  this, SLOT(error()));
    connect(&actionCreator,    SIGNAL(operationFailed()),  this, SLOT(error()));
    connect(&actionHandler,     SIGNAL(exception()), this, SLOT(error()));

    /* Developer Test Connections */
    connect(ui.actionDeveloper_Test, SIGNAL(triggered()), this, SLOT(runDeveloperTest()));
    connect(&smartMatch, SIGNAL(stopTestTime()), this, SLOT(endTimer()));

    /* Action Handler Connections */
    connect(&actionHandler, SIGNAL(updateProgress(int)),            ui.progressBar,         SLOT(setValue(int)));
    connect(&actionHandler, SIGNAL(updateActionLabel(QString)),     ui.actionLabel,         SLOT(setText(QString)));
    connect(&actionHandler, SIGNAL(updateSpeedLabel(QString)),      ui.speedLabel,          SLOT(setText(QString)));
    connect(&actionHandler, SIGNAL(updatePercentageLabel(QString)), ui.mp_busyIndicator,    SLOT(setText(QString)));
    connect(&actionHandler, SIGNAL(setComplete(int)),               this,                   SLOT(setDone(int)));
    connect(&actionHandler, SIGNAL(setSkipped(int)),                this,                   SLOT(setSkip(int)));
    connect(&actionHandler, SIGNAL(setError(int)),                  this,                   SLOT(setError(int)));
    connect(&actionHandler, SIGNAL(setInProgress(int)),             this,                   SLOT(setSync(int)));

    /* Updater Connections */
    connect(&updater,       SIGNAL(complete()),     this,   SLOT(updaterComplete()));

    /* General Connections & Button Stack Connections */
    connect(syncAnimator,           SIGNAL(timeout()),  this,   SLOT(showSync()));
    connect(ui.finishEditButton,    SIGNAL(clicked()),  this,   SLOT(createActions()));
    connect(&actionCreator,         SIGNAL(complete()), this,   SLOT(actionsComplete()));
    connect(ui.runButton,           SIGNAL(clicked()),  this,   SLOT(runActionHandler()));
    connect(ui.searchButton,        SIGNAL(clicked()),  this,   SLOT(searchForSync()));
    connect(&actionHandler,         SIGNAL(complete()), this,   SLOT(actionHandlerComplete()));

    /* General Setup*/
    frame = 0;
    currentAction = -1;
    actionHandler.table = ui.actionsTable;
    ui.mp_ProfileLabel->fontMetrics().width(ui.mp_ProfileLabel->text());
    createTrayIcon();
    setupTable();
    fileInterface.loadDatabase();
    recentProfiles = fileInterface.loadRecentProfiles();
    if(recentProfiles.size() > 0)
        showRecentProfiles();

}
Exemplo n.º 30
0
void LogDialog::showTrace(bool show)
{
    m_showTrace = show;
    updateLog();
}