Exemplo n.º 1
3
MainWindow::MainWindow()
{
    outputLog = new QTextEdit(this);
    outputLog->setReadOnly(true);
    outputLog->append("MTG log \n-------\n");



    //to be created a central widget
    //setCentralWidget(new QWidget());
    setCentralWidget(outputLog);
    setWindowIcon(QIcon(":/images/MTG.png"));
    //creating the menu titles
    fileMenu = menuBar()->addMenu(tr("&File"));
    //editMenu = menuBar()->addMenu(tr("&Edit"));
    analyzerMenu = menuBar()->addMenu(tr("Analyzer"));
    DMmenu = menuBar()->addMenu(tr("DataManager"));
    MMmenu = menuBar()->addMenu(tr("MaskManager"));
    viewMenu = menuBar()->addMenu(tr("&View"));
    menuBar()->addSeparator();
    helpMenu = menuBar()->addMenu(tr("&Help"));

    // creating stuff
    //warning: take care of the order you call these functions
    createDockWindows();
    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    QFile file(":/styles.qss");
    file.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(file.readAll());
    qApp->setStyleSheet(styleSheet);

    setWindowTitle(tr("Matrix Tool GUI"));
    setIconSize(QSize(35,35));

    desktop = qApp->desktop();

    connect(desktop, SIGNAL(resized(int)), this, SLOT(centerMainWindowGeometry()));

    //connect(dataManager, SIGNAL(plotHisto(QPair<matrixData*, QString>)), this, SLOT(raisePlotDock()));
    connect(dataManager, SIGNAL(plotHisto(QPair<matrixData*, QString>)), plotWidget, SLOT(histoMatrix(QPair<matrixData*, QString>)));

    //connect(dataManager, SIGNAL(inspectMatrixData(QPair<matrixData*, QString>)), this, SLOT(raiseEVDock()));
    connect(dataManager, SIGNAL(inspectMatrixData(QPair<matrixData*, QString>)),eventViewer, SLOT(attachMatrixData(QPair<matrixData*, QString>)));

    //raise the involved dock when action is triggered
    connect(newDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(rmDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(rmAllDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(plotDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
        connect(plotDataSetAct, SIGNAL(triggered()), this, SLOT(raisePlotDock()));
    connect(saveDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(inspectEventAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
        connect(inspectEventAct, SIGNAL(triggered()), this, SLOT(raiseEVDock()));
    connect(renameDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    //
    connect(newMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(printMaskAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(rmMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(renameMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(editMaskAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));


    //raise the involved dock when made visible
    connect(DMviewAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(MMviewAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(plotViewAct, SIGNAL(triggered()), this, SLOT(raisePlotDock()));
    connect(EVviewAct, SIGNAL(triggered()), this, SLOT(raiseEVDock()));

    //connect the log output signals
    connect(dataManager, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
    connect(maskManager, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
    connect(plotWidget, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
    connect(eventViewer, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));


    setUnifiedTitleAndToolBarOnMac(true);

}
Exemplo n.º 2
0
/*===================================================================*/
int InfoNES_LoadSRAM(const char* pFilename)
{
	/*
	 *  Load a SRAM
	 *
	 *  Return values
	 *     0 : Normally
	 *    -1 : SRAM data couldn't be read
	 */

	int fd;
	struct SRAM_DATA SramData;
	int len;

	outputLog(__FILE__,__LINE__, "\r\n InfoNES_LoadSRAM() pFilename = %s", pFilename );
	//fp = fopen( szSaveName, "rb" );
	fd = open( pFilename, O_RDONLY, 0 );
	if ( fd == 0 )
	{
		outputLog(__FILE__,__LINE__, "\r\n InfoNES_LoadSRAM() open failed" );
		return -1;
	}
	// Read SRAM data
	len = read(fd, &SramData, sizeof(SramData));
	// Close SRAM file
	close( fd );

	if( len != sizeof(SramData) ){
		return -1;
	}
	InfoNES_SetSRAMData( &SramData );

	// Successful
	return 0;
}
JNIEnv* PluginUtils::getEnv()
{
    bool bRet = false;
    JNIEnv* env = NULL;
    do
    {
        if (JAVAVM->GetEnv((void**)&env, JNI_VERSION_1_4) != JNI_OK)
        {
        	outputLog("PluginUtils", "Failed to get the environment using GetEnv()");
            break;
        }

        if (JAVAVM->AttachCurrentThread(&env, 0) < 0)
        {
            outputLog("PluginUtils", "Failed to get the environment using AttachCurrentThread()");
            break;
        }

        bRet = true;
    } while (0);

    if (!bRet) {
    	env = NULL;
    }

    return env;
}
Exemplo n.º 4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
//    m_parseHtml(new ParseHtml),
    m_httpDownload(new HttpDownload())
{
    ui->setupUi(this);
    ui->progressBar->setValue(0);

//    QThread* thread = new QThread;
//    m_httpDownload->moveToThread(thread);
//    thread->start();

    connect(ui->downloadBtn, SIGNAL(clicked()),
            this, SLOT(startDownload()));

    connect(m_httpDownload, SIGNAL(updateDownloadProgressbar(qint64, qint64)),
            this, SLOT(updateProgressbar(qint64, qint64)));
    connect(m_httpDownload, SIGNAL(outputLog(QString)),
            this, SLOT(appendLog(QString)));
    connect(m_httpDownload, SIGNAL(htmlCount(int)),
            this, SLOT(updateHtmlCount(int)));

    connect(m_httpDownload, SIGNAL(imgCount(int)),
            this, SLOT(updateImgCount(int)));

//    connect(m_parseHtml, SIGNAL(updateLog(QStringList)),
//                this, SLOT(appendLog(QStringList)));

//    connect(m_parseHtml, SIGNAL(downloadImg(QString)),
//                this, SLOT(downloadImg(QString)));
//    connect(m_parseHtml, SIGNAL(updateCount(int)),
//                this, SLOT(updateCount(int)));
}
Exemplo n.º 5
0
/*===================================================================*/
int InfoNES_SaveSRAM(const char* pFilename)
{
	/*
	 *  Save a SRAM
	 *
	 *  Return values
	 *     0 : Normally
	 *    -1 : SRAM data couldn't be written
	 */
	int fd;
	int len;
	struct SRAM_DATA SramData;

	/*-------------------------------------------------------------------*/
	/*  Compress a SRAM data                                             */
	/*-------------------------------------------------------------------*/
	InfoNES_GetSRAMData( &SramData );
	/*-------------------------------------------------------------------*/
	/*  Write a SRAM data                                                */
	/*-------------------------------------------------------------------*/
	// Open SRAM file
//	fp = fopen( szSaveName, "wb+" );
	outputLog(__FILE__,__LINE__, "\r\n InfoNES_SaveSRAM() pFilename = %s", pFilename );
	fd = creat(pFilename, 0666 );
//	fd = open( pFilename, O_WRONLY|O_CREAT, 0666 );
	if ( fd == 0 )
	{
		outputLog(__FILE__,__LINE__, "\r\n InfoNES_SaveSRAM() create failed" );
		return -1;
	}

	// Write SRAM data
	len = pwrite(fd, &SramData, sizeof(SramData), 0);
	// Close SRAM file
	close( fd );

	// Successful
	return (len == sizeof(SramData))? 0 : -1 ;
}
void PluginUtils::initPluginWrapper(android_app* app)
{
    PluginJniMethodInfo t;
    if (! PluginJniHelper::getStaticMethodInfo(t
        , "org/cocos2dx/plugin/PluginWrapper"
        , "initFromNativeActivity"
        , "(Landroid/app/Activity;)V"))
    {
        outputLog("PluginUtils", "Failed to init context of plugin");
        return;
    }

    t.env->CallStaticVoidMethod(t.classID, t.methodID, app->activity->clazz);
    t.env->DeleteLocalRef(t.classID);
}
Exemplo n.º 7
0
void erasePluginJavaData(std::string& key)
{
    JObjPluginMapIter pluginIt = s_JObjPluginMap.find(key);
    if (pluginIt != s_JObjPluginMap.end())
    {
        PluginProtocol* pKeyObj=pluginIt->second;
        ObjMapIter it = s_PluginObjMap.find(pKeyObj);
        if (it != s_PluginObjMap.end()) {
            PluginJavaData* pData = it->second;
            if (pData != NULL)
            {
                jobject jobj = pData->jobj;
                JNIEnv* pEnv = getEnv();
                outputLog("PluginUtils", "Delete global reference.");
                pEnv->DeleteGlobalRef(jobj);
                delete pData;
            }
            s_PluginObjMap.erase(it);
        }
        s_JObjPluginMap.erase(pluginIt);
    }
}
Exemplo n.º 8
0
void PluginUtils::erasePluginJavaData(PluginProtocol* pKeyObj,int pluginType)
{
    ObjMapIter it = s_PluginObjMap.find(pKeyObj);
    if (it != s_PluginObjMap.end()) {
        PluginJavaData* pData = it->second;
        if (pData != NULL)
        {
            jobject jobj = pData->jobj;
            std::string key=getPluginKey(pData->jclassName,pluginType);
            JObjPluginMapIter pluginIt = s_JObjPluginMap.find(key);
            if (pluginIt != s_JObjPluginMap.end())
            {
            	s_JObjPluginMap.erase(pluginIt);
            }

            JNIEnv* pEnv = getEnv();
            outputLog("PluginUtils", "Delete global reference.");
            pEnv->DeleteGlobalRef(jobj);
            delete pData;
        }
        s_PluginObjMap.erase(it);
    }
}
Exemplo n.º 9
0
void INLOG(INTERFACE_LOG& inLog)
{
    outputLog(Info, "%lu|%s|%lx|%u|%u|%s|%s|1|0||||||%u", getTimeMs(), ip2str(inLog.ip), inLog.uid64,  inLog.uid, inLog.requestId, inLog.module, inLog.interface, inLog.towardId);
}
Exemplo n.º 10
0
void OUTLOG(INTERFACE_LOG& outLog, uint32_t stat)
{
    outLog.setStat(stat);
    outputLog(Info, "%lu|%s|%lx|%u|%u|%s|%s|2|%u||||||%u", getTimeMs(), ip2str(outLog.ip), outLog.uid64, outLog.uid, outLog.requestId, outLog.module, outLog.interface, stat, outLog.towardId);
}
Exemplo n.º 11
0
int Mesh::loadShaders(const char* vertexFile, const char* fragmentFile)
{
	GLint result = GL_FALSE;
	int infoLogLength;
	GLuint vertexShaderID = glCreateShader(GL_VERTEX_SHADER);
	GLuint fragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);

	std::ofstream outputLog("output.txt", std::ios::out);

	std::string vertexShaderCode;
	std::ifstream vertexShaderStream(vertexFile, std::ios::in);
	if(vertexShaderStream.is_open())
	{
		char line[256];
		while(vertexShaderStream.getline(line, 256))
		{
			vertexShaderCode += std::string("\n");
			vertexShaderCode += std::string(line);
		}
		vertexShaderStream.close();
	}
	const char* vertexShaderSource = vertexShaderCode.c_str();

	// Compile vertex shader
	glShaderSource(vertexShaderID, 1, &vertexShaderSource, NULL);
	glCompileShader(vertexShaderID);

	// Check vertex shader
	glGetShaderiv(vertexShaderID, GL_COMPILE_STATUS, &result);
	glGetShaderiv(vertexShaderID, GL_INFO_LOG_LENGTH, &infoLogLength);
	std::vector<char> vertexShaderErrorMessage(infoLogLength);
	glGetShaderInfoLog(vertexShaderID, infoLogLength, NULL, &vertexShaderErrorMessage[0]);
	
	if(outputLog.is_open())
	{
		outputLog<<&vertexShaderErrorMessage[0]<<std::endl;
	}

	std::string fragmentShaderCode;
	std::ifstream fragmentShaderStream(fragmentFile, std::ios::in);
	if(fragmentShaderStream.is_open())
	{
		char line[256];
		while(fragmentShaderStream.getline(line, 256))
		{
			fragmentShaderCode += std::string("\n");
			fragmentShaderCode += std::string(line);
		}
		fragmentShaderStream.close();
	}
	const char* fragmentShaderSource = fragmentShaderCode.c_str();

	// Compile fragment shader
	glShaderSource(fragmentShaderID, 1, &fragmentShaderSource, NULL);
	glCompileShader(fragmentShaderID);

	// Check fragment shader
	glGetShaderiv(fragmentShaderID, GL_COMPILE_STATUS, &result);
	glGetShaderiv(fragmentShaderID, GL_INFO_LOG_LENGTH, &infoLogLength);
	std::vector<char> fragmentShaderErrorMessage(infoLogLength);
	glGetShaderInfoLog(fragmentShaderID, infoLogLength, NULL, &fragmentShaderErrorMessage[0]);
	
	if(outputLog.is_open())
	{
		outputLog<<&fragmentShaderErrorMessage[0]<<std::endl;
	}

	// Create and link a program
	GLuint programID = glCreateProgram();
	glAttachShader(programID, vertexShaderID);
	glAttachShader(programID, fragmentShaderID);
	glLinkProgram(programID);

	// Check the program
	glGetProgramiv(programID, GL_LINK_STATUS, &result);
	glGetProgramiv(programID, GL_INFO_LOG_LENGTH, &infoLogLength);
	std::vector<char> programErrorMessage(infoLogLength);
	glGetProgramInfoLog(programID, infoLogLength, NULL, &programErrorMessage[0]);
	
	if(outputLog.is_open())
	{
		outputLog<<&programErrorMessage[0]<<std::endl;
	}

	outputLog.close();

	glDeleteShader(vertexShaderID);
	glDeleteShader(fragmentShaderID);

	return programID;
}
Exemplo n.º 12
0
int driver (int t_num)
{
    int i, j;
#ifdef OUT_PERIOD
 outputLog("d0|");
#endif

    /* Actually, WaitTimes are needed... */
    while( activate_transaction ){
      switch(seq_get()){
      case 0:
#ifdef OUT_PERIOD
 outputLog("d1|");
#endif
	do_neword(t_num);
#ifdef OUT_PERIOD
 outputLog("d1e|");
#endif
	break;
      case 1:
#ifdef OUT_PERIOD
 outputLog("d2|");
#endif
	do_payment(t_num);
#ifdef OUT_PERIOD
 outputLog("d2e|");
#endif
	break;
      case 2:
#ifdef OUT_PERIOD
 outputLog("d3|");
#endif
	do_ordstat(t_num);
#ifdef OUT_PERIOD
 outputLog("d3e|");
#endif
	break;
      case 3:
#ifdef OUT_PERIOD
 outputLog("d4|");
#endif
	do_delivery(t_num);
#ifdef OUT_PERIOD
 outputLog("d4e|");
#endif
	break;
      case 4:
#ifdef OUT_PERIOD
 outputLog("d5|");
#endif
	do_slev(t_num);
#ifdef OUT_PERIOD
 outputLog("d5e|");
#endif
	break;
      default:
#ifdef OUT_PERIOD
 outputLog("d6|");
#endif
	printf("Error - Unknown sequence.\n");
      }

    }

    return(0);

}
Exemplo n.º 13
0
int _tmain(int argc, _TCHAR* argv[])
{
	if (argc < 3) {
		fprintf(stderr, "Please specify the CF test location: \n vdma_desktop.exe \\\\Storage Card\\CF\\Db4objects.Db4o.Tests.exe run");
		return -1;
	}
	wprintf(L"argv[1] %s\n", argv[1]);
	wprintf(L"argv[2] %s\n", argv[2]);

	char Buffer[DMA_PACKET_SIZE];
	size_t Count;
	wcstombs_s(&Count, Buffer, DMA_PACKET_SIZE, argv[1], DMA_PACKET_SIZE); 

    CoInitializeEx(NULL, COINIT_MULTITHREADED|COINIT_DISABLE_OLE1DDE);

    // Ask the user to select a running emulator to connect to
    GUID VMID;
    if (!ChooseVMID(&VMID)) {
		wchar_t GUID_string[60];
		StringFromGUID2(VMID, GUID_string, sizeof(GUID_string)/sizeof(GUID_string[0]));
        fwprintf(stderr, L"Error: ChooseVMID - %s failed\n", GUID_string);
        return -2;
    }

    // Create the DMA channel
    DesktopDMAChannel Channel(&VMID);

    // Choose a channel name.  The desktop and device sides must agree on the same
    // name, and it must be unique.  The easiest way to name a channel is to use
    // uuidgen.exe to generate a GUID.
    const char ChannelName[] = "34a0f021-362f-4e43-a223-5bdac54eb315";

    // Hook up the channel
    unsigned __int32 ChannelNumber = Channel.DiscoverChannelNumber((unsigned __int8*)ChannelName, sizeof(ChannelName), INFINITE);
    if (ChannelNumber == 0) {
        fprintf(stderr, "Error: Channel.DiscoverChannelNumber failed\n");
        return -3;
    }

    // Open the channel
    HRESULT hr = Channel.Open(ChannelNumber);
    if (FAILED(hr)) {
        fprintf(stderr, "Error: Channel.Open failed with hr=%x\n", hr);
        return -4;
    }

    hr = Channel.Write((unsigned char *)Buffer, &Count, INFINITE);
    if (FAILED(hr)) {
        fprintf(stderr, "Error: Channel.Write failed with hr=%x\n", hr);
		return -5;
    }
    memset(Buffer, 0, sizeof(Buffer)); // prove that the echo is returning
    Count = sizeof(Buffer);
    hr = Channel.Read((unsigned char *)Buffer, &Count, INFINITE);
    if (FAILED(hr)) {
        fprintf(stderr, "Error: Channel.Read failed with hr=%x\n", hr);
        return -6;
    }
    
	int exitcode = atoi(Buffer);
	if ((exitcode==0) && (strncmp("0", Buffer, Count)!=0))
	{
		fprintf(stderr, "Unexpected error!");
		exitcode = -7;
	}
	
    Channel.Close();

	printf("Return: %d\n", exitcode);

	//print test log to stderr.
	outputLog(argv[2]);
	return exitcode;
}