Пример #1
0
void CreateEditPage::load(void)
{
	const Tag *tag = TagStorage::storage()->tag(m_tag);	

	if (m_tag == TagStorage::TEMPORARY_TAG) {
		setDefaultName(tr("Harvested tag"));
	} else {
		m_name->setContents(tag->name());
	}

	if (setupData(tag->message()) == false) {
		goto fail;
	} else {
		setContentValidity(true);
	}

	return;

fail:
	setupNewData();
	MMessageBox *box = new MMessageBox(tr("Cannot read the tag. "
					      "The tag contents may be "
					      "invalid. "));
	box->appear(MSceneWindow::DestroyWhenDismissed);	
}
Пример #2
0
int main( int argc, char** argv )
{
    // set up GLUT
    glutInit( &argc, argv );
    glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
    glutInitWindowSize( windowW, windowH );
    glutCreateWindow( "Tree" );
    
    // change default settings
    init();

    // create view
    setupData();
    
    // set callbacks
    glutDisplayFunc( display );
    glutReshapeFunc( resize );
    glutMouseFunc( mouse );
    glutMotionFunc( mouseMove );
    glutKeyboardFunc( keyboard );
    
    // run
    glutMainLoop();
    return EXIT_SUCCESS;
}
Пример #3
0
TrainerMenu::TrainerMenu(TeamHolder *team) :
    ui(new Ui::TrainerMenu), m_team(team)
{
    ui->setupUi(this);
    Theme::ToolButtonIcon(ui->teamFolderButton, Theme::ChangeTeamFolder);
    Theme::ToolButtonIcon(ui->removeTeam, Theme::DeleteTeam);
    Theme::ToolButtonIcon(ui->saveTeam, Theme::SaveTeam);
    Theme::ToolButtonIcon(ui->loadTeam, Theme::LoadTeam);
    Theme::ToolButtonIcon(ui->importTeam, Theme::ImportTeam);
    Theme::ToolButtonIcon(ui->addTeam, Theme::AddTeam);
    ui->name->setValidator(new QNickValidator(this));
    ui->close->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCloseButton));

    QPushButton *buttons[6] = {ui->team1, ui->team2, ui->team3, ui->team4, ui->team5, ui->team6};
    memcpy(teamButtons, buttons, sizeof(buttons));

    QButtonGroup *bg = new QButtonGroup(this);
    for (int i = 0; i < 6; i++) {
        buttons[i]->setCheckable(true);
        bg->addButton(buttons[i], i);
    }
    buttons[0]->setChecked(true);

    connect(bg, SIGNAL(buttonClicked(int)), SLOT(changeCurrentTeam(int)));

    connect(ui->pokemonButtons, SIGNAL(teamChanged()), SIGNAL(teamChanged()));
    connect(ui->boxCenter, SIGNAL(clicked()), SIGNAL(openBoxes()));
    //connect(ui->pokemonButtons, SIGNAL(doubleClicked(int)), SIGNAL(editPoke(int)));
    connect(ui->pokemonButtons, SIGNAL(clicked(int)), SIGNAL(editPoke(int))); //I prefer double click, but for newbies...
    connect(ui->teambuilderLabel, SIGNAL(clicked()), SLOT(openTeam()));

    loadProfileList();
    setupData();
}
SGMEnergyPositionTestView::SGMEnergyPositionTestView(SGMEnergyPosition *energyPosition, QWidget *parent) : QWidget(parent)
{
    energyPosition_ = energyPosition;
    setupUi();
    setupData();
    makeConnections();
}
Пример #5
0
ShortcutSetting::ShortcutSetting(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ShortcutSetting)
{
    ui->setupUi(this);

    setupViews();
    setupData();
}
Пример #6
0
void DataManager::onProcessPacket(const mon_bin_get* packet)
{
	QSqlQuery packetQuery;
	packetQuery.prepare("INSERT INTO `packets` "
			"(urb_id, device, bus, endpoint, time, status) "
			"VALUES(?,?,?,?,?,?);");
	QSqlQuery dataQuery;
	dataQuery.prepare("INSERT INTO `data` "
				"(packet_id, data, type) "
				"VALUES(?, ?, ?);");
	packetQuery.bindValue(0, packet->header->id);
	packetQuery.bindValue(1, packet->header->device);
	packetQuery.bindValue(2, packet->header->bus);
	packetQuery.bindValue(3, packet->header->endpoint);
	packetQuery.bindValue(4, QDateTime::fromTime_t(packet->header->ts_sec).addMSecs(packet->header->ts_usec/1000).toString("hh:mm:ss.zzz"));
	packetQuery.bindValue(5, (unsigned char)packet->header->status);

	if(!packetQuery.exec())
		goto error;

	dataQuery.bindValue(0, packetQuery.lastInsertId().toUInt());
	packetQuery.finish();

	if(packet->header->flag_setup == 0)
	{
		QByteArray setupData((const char*) packet->header->setup, 8);
		dataQuery.bindValue(1, setupData);
		dataQuery.bindValue(2, "Setup");
	}
	else if(packet->header->lengthCaptured > 0)
	{
		QByteArray data((const char*) packet->data, packet->header->lengthCaptured);
		dataQuery.bindValue(1, data);
		dataQuery.bindValue(2, "Data");
	}

	if(dataQuery.boundValues().size() == 3 && !dataQuery.exec())
		goto error;

	dataQuery.finish();
	goto cleanup;

error:
	database.rollback();
	qDebug() << "Database error: " << database.lastError().databaseText() << database.lastError().driverText();
	goto cleanup;

cleanup:
	delete packet->header;
	delete[] (char*)packet->data;
	delete packet;
	return;
}
NamespaceManagementDialog::NamespaceManagementDialog(QWidget *parent, Element *element, NamespaceManager *nsManager) :
    QDialog(parent),
    ui(new Ui::NamespaceManagementDialog)
{
    _goComboNs = false;
    _element = element ;
    _nsManager = nsManager ;
    ui->setupUi(this);
    init();
    setupData();
    updateButtonsNs();
    enableOk();
}
Пример #8
0
CcgView::CcgView(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::CcgView)
{
    ui->setupUi(this);

    // check that the command line program is installed
    if (!fileExists(QString(CCG_BINARY))) {
        QMessageBox::information(this, "ccg binary not found",
                                 "The ccg command line program " \
                                 "must be installed in order for " \
                                 "this GUI to work");
        close();
        return;
    }

    setRanges();
    setDefaults();
    setupData();

    // When the calculate button is pressed
    connect(ui->pushButtonCalculate, SIGNAL(clicked()),
            this, SLOT(calculate()));
    // When data sources is selected open the data dialog
    connect(ui->actionDataSources,SIGNAL(triggered()),
            this,SLOT(openDataSources()));
    // Save the current image
    connect(ui->actionSaveImage,SIGNAL(triggered()),
            this,SLOT(saveImageAs()));
    // Exit the application
    connect(ui->actionExit,SIGNAL(triggered()),
            this,SLOT(close()));
    // open the about dialog
    connect(ui->actionAbout,SIGNAL(triggered()),
            this,SLOT(openAbout()));
    // Event for detecting mouse click on image
    ui->graphicsView->installEventFilter(this);

    statusLabel.setText("Ready");
    statusLabel.setIndent(3);
    ui->statusBar->addWidget(&statusLabel);

    ui->spinBoxStartYear->setValue(globals.startYear);
    ui->spinBoxEndYear->setValue(globals.endYear);
    ui->comboBoxPlotType->setCurrentIndex(globals.plotTypeIndex);
    ui->comboBoxRegion->setCurrentIndex(globals.regionIndex);

    showingImage=false;
}
Пример #9
0
void 
DarkenManager::init(int argc, char **argv)
{
    setupGL(argc, argv);

    clTools::initOpenCL (m_context, m_id, m_queue, "", true, true);
    setupData();
    setupCLprog();
    setupShaders();

#ifdef _WIN32
    QueryPerformanceFrequency((LARGE_INTEGER*)&m_ticksPerSecond);
    QueryPerformanceCounter((LARGE_INTEGER*)&m_start_ticks);
#endif //_WIN32
    m_frames = 0;

}
Пример #10
0
void AllocateFFTFramework(int *Error){
#ifndef NO_OPENCL
	std::auto_ptr< clAmdFftSetupData > setupData( new clAmdFftSetupData );
	*Error = clAmdFftInitSetupData( setupData.get( ));

	if(*Error != 0){
		*Error = clLabviewDevice::Error(OPENCLV_CANT_INIT_FFT_FRAMEWORK);
		return;
	}

	*Error = clAmdFftSetup( setupData.get( ) );

	if(*Error != 0){
		*Error = clLabviewDevice::Error(OPENCLV_CANT_INIT_FFT_FRAMEWORK);
		return;
	}
#endif
}
Пример #11
0
xtHelp::xtHelp(QWidget *parent)
  : QHelpEngine(QHC_PATH, parent),
  _nam(new QNetworkAccessManager),
  _online(false)
{
  connect(_nam, SIGNAL(finished(QNetworkReply *)), this, SLOT(sError(QNetworkReply *)));

  if(!setupData())
    qWarning("Error setting up the help data");

/* TODO: remove the #ifdef and the empty help file & its corresponding qhc
         from xtuple/share once we fix the remote image loading bug in fileData
*/
#ifdef XTHELPONLINE
  _online = fileData(QUrl(QHCHOMEPAGE)) == QByteArray("");
#endif // XTHELPONLINE

  if (DEBUG)
    qDebug() << "xtHelp collection file" << collectionFile()
             << "exists?"   << QFile::exists(collectionFile())
             << "online?"   << _online;
}
Пример #12
0
void
submitJob(const char* modem, char* otag)
{
    u_long tts = 0;
    time_t t = time(0);
    struct tm* now = localtime(&t);

    sprintf(qfile, "%s/q%d", FAX_SENDDIR, seqnum = getSequenceNumber());
    qfd = fopen(qfile, "w");
    if (qfd == NULL) {
	syslog(LOG_ERR, "%s: Can not create qfile: %m", qfile);
	sendError("Can not create qfile \"%s\".", qfile);
	cleanupJob();
    }
    flock(fileno(qfd), LOCK_EX);
    fprintf(qfd, "modem:%s\n", modem);
    for (;;) {
	if (!getCommandLine())
	    cleanupJob();
	if (isCmd("end") || isCmd(".")) {
	    setupData(seqnum);
	    break;
	}
	if (isCmd("sendAt")) {
	    tts = cvtTime(tag, now, "time-to-send");
	} else if (isCmd("killtime")) {
	    fprintf(qfd, "%s:%lu\n", line, cvtTime(tag, now, "kill-time"));
	} else if (isCmd("cover")) {
	    coverProtocol(atoi(tag), seqnum);
	} else
	    fprintf(qfd, "%s:%s\n", line, tag);	/* XXX check info */
    }
    fprintf(qfd, "tts:%lu\n", tts);
    fclose(qfd), qfd = NULL;
    if (!notifyServer(modem, "S%s", qfile))
	sendError("Warning, no server appears to be running.");
    sendClient("job", "%d", seqnum);
}
Пример #13
0
// main window procedure
LONG WINAPI MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    LONG lRet = 1;
    PAINTSTRUCT ps;
    RECT rect;

    switch (uMsg) {

    case WM_CREATE:
        ghDC = GetDC(hWnd);
        if (!setupPixelFormat(ghDC)) {
            PostQuitMessage(0);
        }

        initializeGL();
        GetClientRect(hWnd, &rect);
        resize(rect.right, rect.bottom); // added in leiu of passing dims to initialize
        g_programs.compilePrograms();

        setupData(rect.right, rect.bottom);

        ::SetTimer(hWnd, DRAW_TIMER_ID, 0, DrawTimerProc);

        break;

    case WM_PAINT:
        BeginPaint(hWnd, &ps);
        EndPaint(hWnd, &ps);
        break;

    case WM_SIZE:
        GetClientRect(hWnd, &rect);
        resize(rect.right, rect.bottom);
        break;

    case WM_CLOSE:
        doCleanup(hWnd);
        DestroyWindow(hWnd);
        break;

    case WM_DESTROY:
        doCleanup(hWnd);
        PostQuitMessage(0);
        break;

    case WM_KEYDOWN:
        switch (wParam) {
        case 'P':
            g_paused = !g_paused;
            break;

        //case 'W':
        //    if (g_shiftPressed) {
        //        g_camera.moveUp(MOVE_AMOUNT);
        //    }
        //    else {
        //        g_camera.moveForward(MOVE_AMOUNT);
        //    }
        //    redoModelViewMatrix();
        //    break;

        //case 'A':
        //    g_camera.moveSide(-MOVE_AMOUNT);
        //    redoModelViewMatrix();
        //    break;

        //case 'S':
        //    if (g_shiftPressed) {
        //        g_camera.moveUp(-MOVE_AMOUNT);
        //    }
        //    else {
        //        g_camera.moveForward(-MOVE_AMOUNT);
        //    }
        //    redoModelViewMatrix();
        //    break;

        //case 'D':
        //    g_camera.moveSide(MOVE_AMOUNT);
        //    redoModelViewMatrix();
        //    break;

        //case 'Q':
        //    g_camera.spinAroundFwd(SPIN_AMOUNT);
        //    redoModelViewMatrix();
        //    break;

        //case 'E':
        //    g_camera.spinAroundFwd(-SPIN_AMOUNT);
        //    redoModelViewMatrix();
        //    break;

        //case VK_UP:
        //    g_camera.spinAroundSide(-SPIN_AMOUNT);
        //    redoModelViewMatrix();
        //    break;

        //case VK_DOWN:
        //    g_camera.spinAroundSide(SPIN_AMOUNT);
        //    redoModelViewMatrix();
        //    break;

        //case VK_LEFT:
        //    //if (g_shiftPressed) {
        //    //    g_camera.spinAroundFwd(SPIN_AMOUNT);
        //    //}
        //    //else {
        //    g_camera.spinAroundUp(SPIN_AMOUNT);
        //    //}
        //    redoModelViewMatrix();
        //    break;

        //case VK_RIGHT:
        //    //if (g_shiftPressed) {
        //    //    g_camera.spinAroundFwd(-SPIN_AMOUNT);
        //    //}
        //    //else {
        //    g_camera.spinAroundUp(-SPIN_AMOUNT);
        //    //}
        //    redoModelViewMatrix();
        //    break;

        case VK_SHIFT:
            g_shiftPressed = true;
            break;
        }
        break;

    case WM_KEYUP:
        switch (wParam) {
        case VK_SHIFT:
            g_shiftPressed = false;
            break;
        }
        break;

    case WM_LBUTTONDOWN:
        g_mouse.l_btn_down = true;
        break;

    case WM_LBUTTONUP:
        g_mouse.l_btn_down = false;
        break;

    case WM_MOUSEMOVE: {
        int x = GET_X_LPARAM(lParam);
        int y = GET_Y_LPARAM(lParam);
        if (g_mouse.l_btn_down) {
            moveCameraByMouseMove(x, y, g_mouse.last_x, g_mouse.last_y);
        }
        g_mouse.last_x = x;
        g_mouse.last_y = y;
        break;
    }

    case WM_MOUSEWHEEL: {
        int delta = GET_WHEEL_DELTA_WPARAM(wParam);
        zoomCameraByMouseWheel(delta);
        break;
    }

    default:
        lRet = DefWindowProc(hWnd, uMsg, wParam, lParam);
        break;
    }

    return lRet;
}
Пример #14
0
void QHelpEngineWrapper::initialDocSetupDone()
{
  connect(this, SIGNAL(setupFinished()),
          searchEngine(), SLOT(indexDocumentation()));
  setupData();
}
Пример #15
0
void TrainerMenu::updateAll()
{
    setupData();
}
Пример #16
0
//--------------------------------------------------------------
void testApp::update(){
    
    ofBackground(0);
    
    kinect.updateThreshPar(iFarThreshold, iNearThreshold);
    kinect.updateBlobPar(iMinBlobSize, iMaxBlobSize, iMaxNumBlobs);
    
    if(!bLockKinTilt) {
        kinect.setKinTiltAngle(false, fKin1TiltAngle);
        kinect.setKinTiltAngle(true, fKin2TiltAngle);
    }
    
    kinect.update();
    
    if(bResetData) {
        bResetData = false;
        setupData();
    }
    
    if( isAddingParticles ) {
        if(!hasAddedNeutrals && time(0)-addingStartTime > addingWaitTime ) {
            addParticles(PERSONAL, NEUTRAL, pneu);
            addParticles(NEIGHBORHOOD, NEUTRAL, nneu);
            addParticles(CITY, NEUTRAL, cneu);
            
            hasAddedNeutrals = true;
        }
        if(hasAddedNeutrals && time(0)-addingStartTime > (addingWaitTime * 2)) {
            addParticles(PERSONAL, POSITIVE, ppos);
            addParticles(NEIGHBORHOOD, POSITIVE, npos);
            addParticles(CITY, POSITIVE, cpos);
            
            isAddingParticles = false;
            hasAddedNeutrals = false;
        }
    }
    

    // CONVERT TOP AND BOTTOM ANCHORS INTO POSITIVES AND NEGATIVES ATTRACTION POINTS
    for(int i = 0; i < b2dParticles.size(); i++) {
        Data * customData = (Data*)b2dParticles[i].getData();        
        switch(customData->scope) {
            case PERSONAL:
                if(customData->type == NEGATIVE) {
                    b2dParticles[i].addAttractionPoint(personalAnchorBottom.getPosition(), fAttractionForce);
                    b2dParticles[i].addRepulsionForce(personalCenter, fAttractionForce);
                } else if(customData->type == NEUTRAL) {
                    b2dParticles[i].addAttractionPoint(personalCenter, fAttractionForce);                    
                } else if(customData->type == POSITIVE) {
                    b2dParticles[i].addAttractionPoint(personalAnchorTop.getPosition(), fAttractionForce);
                    b2dParticles[i].addRepulsionForce(personalCenter, fAttractionForce);
                }
                break;
            case NEIGHBORHOOD:
                if(customData->type == NEGATIVE) {
                    b2dParticles[i].addAttractionPoint(neighborhoodAnchorBottom.getPosition(), fAttractionForce);
                    b2dParticles[i].addRepulsionForce(neighborhoodCenter, fAttractionForce);
                } else if(customData->type == NEUTRAL) {
                    b2dParticles[i].addAttractionPoint(neighborhoodCenter, fAttractionForce);                    
                } else if(customData->type == POSITIVE) {
                    b2dParticles[i].addAttractionPoint(neighborhoodAnchorTop.getPosition(), fAttractionForce);
                    b2dParticles[i].addRepulsionForce(neighborhoodCenter, fAttractionForce);
                }
                break;
            case CITY:
                if(customData->type == NEGATIVE) {
                    b2dParticles[i].addAttractionPoint(cityAnchorBottom.getPosition(), fAttractionForce);
                    b2dParticles[i].addRepulsionForce(cityCenter, fAttractionForce);
                } else if(customData->type == NEUTRAL) {
                    b2dParticles[i].addAttractionPoint(cityCenter, fAttractionForce);                    
                } else if(customData->type == POSITIVE) {
                    b2dParticles[i].addAttractionPoint(cityAnchorTop.getPosition(), fAttractionForce);
                    b2dParticles[i].addRepulsionForce(cityCenter, fAttractionForce);
                }
                break;
        }
    }
    
    box2d.wakeupShapes();    
    box2d.update();	

    
    // MARK: BLOBS BOXES

    
    // destroy dead blobs/boxes
    for(map<int, ofxBox2dRect>::iterator it = b2dBlobs.begin(); it != b2dBlobs.end(); it++) {
        if( kinect.foundBlobsMap.find((*it).first) == kinect.foundBlobsMap.end() ) {
            ((*it).second).destroy();
            b2dBlobs.erase(it);
        }
    }
    
    // update and add blobs/boxes
    for(int i = 0; i < kinect.activeBlobsIds.size(); i++) {
        
        // search for the key on the map
        int theKey = kinect.activeBlobsIds[i];
        ofxBlob b = kinect.foundBlobsMap[theKey];
        map<int, ofxBox2dRect>::iterator it = b2dBlobs.find(theKey);

        // if it's already on it, update box
        if( it != b2dBlobs.end() ) {
            // inverting blob x
            float x = ofMap(b.centroid.x, 1.0f, 0.0f, 0.0f, 1.0f);
            b2dBlobs[theKey].setPosition(x * FBO_W, b.centroid.y * FBO_H);
        }
        
        // else, add box to the map and the world 
        else {
            ofxBox2dRect r;
            r.setPhysics(fDensity, fBounce, fFriction);
            // inverting blob x
            float x = ofMap(b.centroid.x, 1.0f, 0.0f, 0.0f, 1.0f);
            r.setup(box2d.getWorld(), x * FBO_W, b.centroid.y * FBO_H, 
                    b.boundingRect.width * FBO_W, b.boundingRect.height * FBO_H);
            
            b2dBlobs[theKey] = r;
        }
    }
    
    
    
// MARK: UPDATE ATTRACTION FORCE
//    for(int i = 0; i < b2dParticles.size(); i++) {        
//        Data * customData = (Data*)b2dParticles[i].getData();        
//        b2dParticles[i].addAttractionPoint(customData->attractionPoint, fAttractionForce);
//    }
    
}
Пример #17
0
	imageHeight(0),              // height of image in pixels
	frameZeroSize(0),            // Size of frame 0
	frameZeroOffset(0),          // Frame 0 offset
	headerSize(0),               // size of header in bytes
	metaDataSize(0),             // size of meta data block (images)
	imageInfoSize(0),            // size of image info structure
	imageSeqSize(0),             // Size of image sequence
	offsetBytes(0),              //  number of bytes offset for the file
	setupDataSize(0),            // Size of xml setup block
	versionNum(0),               // Version number
	cropRowLow(0),               // The crop row value on the bottom
	cropRowHigh(0),              // The crop row value in the top
	cropColHigh(0),              // The crop value on the far right
	cropColLow(0),               // The crop value on the far left
	metaData(0),                 // Offset of meta data block
	setupData(0),                // Offset of xml setup block	
	imageInfo(0),                // Offset of image info structure
	imageSeq(0),                 // Offset for image sequence
	width(0),                    // The width of the frame in pixels
	height(0),                   // The height of the frame in pixels
	frameNum(0),                 // The Number of frames.
	frameSize(0),                // Size of an image in...
	frameSizeArray(),            // Size of all 180 frames
	frameOffset()                // Offset of all 180 frames
{

	FILE* fp;
	size_t fb;

	fileName = fileNameParam;
HgWidgetOptionsView::HgWidgetOptionsView(QGraphicsItem *parent) :
    HbView(parent),
    mForm(new HbDataForm(this)),
    mModel(new HbDataFormModel(this)),
    mContentReady(false),
    mUpdateWidgetSize(true)
{
    HbAction *backAction = new HbAction(Hb::BackNaviAction);
    connect(backAction, SIGNAL(triggered()), SIGNAL(optionsClosed()));
    setNavigationAction(backAction);

    HbDataFormModelItem *item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, WIDGET_TYPE);
    item->setContentWidgetData(QString("items"), QStringList("Grid") << "Coverflow" << "T-Bone");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, SCROLLBAR_VISIBILITY);
    item->setContentWidgetData(QString("items"), QStringList("Autohide") << "Always on" << "Always off");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, INTERACTIVE_SCROLLBAR);
    item->setContentWidgetData(QString("text"), QString("no"));
    item->setContentWidgetData(QString("additionalText"), QString("yes"));

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, MODEL_IMAGE_TYPE);
    item->setContentWidgetData(QString("items"), QStringList("QImage") << "HbIcon" << "QIcon" << "QPixmap");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::TextItem, WIDGET_HEIGHT);
    item->setContentWidgetData(QString("text"), QString("0"));
    item->setContentWidgetData(QString("inputMethodHints"), Qt::ImhDigitsOnly);

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::TextItem, WIDGET_WIDTH);
    item->setContentWidgetData(QString("text"), QString("0"));
    item->setContentWidgetData(QString("inputMethodHints"), Qt::ImhDigitsOnly);

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, LOW_RES_IMAGES);
    item->setContentWidgetData(QString("text"), QString("no"));
    item->setContentWidgetData(QString("additionalText"), QString("yes"));

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, TITLE_FONT);
    item->setContentWidgetData(QString("items"), QStringList("Primary") << "Secondary" << "Title" << "Primary small" << "Digital");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, DESCRIPTION_FONT);
    item->setContentWidgetData(QString("items"), QStringList("Primary") << "Secondary" << "Title" << "Primary small" << "Digital");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, REFLECTIONS_ENABLED);
    item->setContentWidgetData(QString("text"), QString("no"));
    item->setContentWidgetData(QString("additionalText"), QString("yes"));

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, EFFECT3D_ENABLED);
    item->setContentWidgetData(QString("text"), QString("no"));
    item->setContentWidgetData(QString("additionalText"), QString("yes"));
    
    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, ITEM_SIZE_POLICY);
    item->setContentWidgetData(QString("text"), QString("User defined"));
    item->setContentWidgetData(QString("additionalText"), QString("Automatic"));

    connect(mModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(updateData(QModelIndex, QModelIndex)));
    mForm->setModel(mModel);

    setupData();
    mContentReady = true;

    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
    layout->addItem(mForm);
    setLayout(layout);
}
Пример #19
0
CppHighlighter::CppHighlighter(QTextEdit *parent)
 : DevHighlighter(parent)
{
	setupData();
}
Пример #20
0
CppHighlighter::CppHighlighter(QTextDocument *parent)
 : DevHighlighter(parent)
{
	setupData();
}
Пример #21
0
HStateVariablesSetupData HAvTransportInfo::stateVariablesSetupData()
{
    HStateVariablesSetupData retVal;

    retVal.insert(HStateVariableInfo("TransportState", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("TransportStatus", HUpnpDataTypes::string));

    HStateVariableInfo setupData("CurrentMediaCategory", HUpnpDataTypes::string);
    setupData.setVersion(2);
    retVal.insert(setupData);

    retVal.insert(HStateVariableInfo("PlaybackStorageMedium", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("RecordStorageMedium", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("PossiblePlaybackStorageMedia", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("PossibleRecordStorageMedia", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("CurrentPlayMode", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("TransportPlaySpeed", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("RecordMediumWriteStatus", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("CurrentRecordQualityMode", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("PossibleRecordQualityModes", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("NumberOfTracks", HUpnpDataTypes::ui4));
    retVal.insert(HStateVariableInfo("CurrentTrack", HUpnpDataTypes::ui4));
    retVal.insert(HStateVariableInfo("CurrentTrackDuration", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("CurrentMediaDuration", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("CurrentTrackMetaData", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("CurrentTrackURI", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("AVTransportURI", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("AVTransportURIMetaData", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("NextAVTransportURI", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("NextAVTransportURIMetaData", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("RelativeTimePosition", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("AbsoluteTimePosition", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("RelativeCounterPosition", HUpnpDataTypes::i4));
    retVal.insert(HStateVariableInfo("AbsoluteCounterPosition", HUpnpDataTypes::ui4));
    retVal.insert(HStateVariableInfo("CurrentTransportActions", HUpnpDataTypes::string, InclusionOptional));
    retVal.insert(HStateVariableInfo("LastChange", HUpnpDataTypes::string));

    setupData = HStateVariableInfo("DRMState", HUpnpDataTypes::string, InclusionOptional);
    setupData.setVersion(2);
    retVal.insert(setupData);

    retVal.insert(HStateVariableInfo("A_ARG_TYPE_SeekMode", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("A_ARG_TYPE_SeekTarget", HUpnpDataTypes::string));
    retVal.insert(HStateVariableInfo("A_ARG_TYPE_InstanceID", HUpnpDataTypes::ui4));

    setupData = HStateVariableInfo("A_ARG_TYPE_DeviceUDN", HUpnpDataTypes::string, InclusionOptional);
    setupData.setVersion(2);
    retVal.insert(setupData);

    setupData = HStateVariableInfo("A_ARG_TYPE_ServiceType", HUpnpDataTypes::string, InclusionOptional);
    setupData.setVersion(2);
    retVal.insert(setupData);

    setupData = HStateVariableInfo("A_ARG_TYPE_ServiceID", HUpnpDataTypes::string, InclusionOptional);
    setupData.setVersion(2);
    retVal.insert(setupData);

    setupData = HStateVariableInfo("A_ARG_TYPE_StateVariableValuePairs", HUpnpDataTypes::string, InclusionOptional);
    setupData.setVersion(2);
    retVal.insert(setupData);

    setupData = HStateVariableInfo("A_ARG_TYPE_StateVariableList", HUpnpDataTypes::string, InclusionOptional);
    setupData.setVersion(2);
    retVal.insert(setupData);

    return retVal;
}
Пример #22
0
int _tmain( int argc, _TCHAR* argv[] )
{
	//	This helps with mixing output of both wide and narrow characters to the screen
	std::ios::sync_with_stdio( false );

	//	Define MEMORYREPORT on windows platfroms to enable debug memory heap checking
#if defined( MEMORYREPORT ) && defined( _WIN32 )
	TCHAR logPath[ MAX_PATH ];
	::GetCurrentDirectory( MAX_PATH, logPath );
	::_tcscat_s( logPath, _T( "\\MemoryReport.txt") );

	//	We leak the handle to this file, on purpose, so that the ::_CrtSetReportFile() can output it's memory
	//	statistics on app shutdown
	HANDLE hLogFile;
	hLogFile = ::CreateFile( logPath, GENERIC_WRITE,
		FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );

	::_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG );
	::_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG );
	::_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG );

	::_CrtSetReportFile( _CRT_ASSERT, hLogFile );
	::_CrtSetReportFile( _CRT_ERROR, hLogFile );
	::_CrtSetReportFile( _CRT_WARN, hLogFile );

	int tmp = ::_CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
	tmp |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF;
	::_CrtSetDbgFlag( tmp );

	//	By looking at the memory leak report that is generated by this debug heap, there is a number with
	//	{} brackets that indicates the incremental allocation number of that block.  If you wish to set
	//	a breakpoint on that allocation number, put it in the _CrtSetBreakAlloc() call below, and the heap
	//	will issue a bp on the request, allowing you to look at the call stack
	//	::_CrtSetBreakAlloc( 1833 );

#endif /* MEMORYREPORT */

	//	OpenCL state 
	cl_device_type		deviceType	= CL_DEVICE_TYPE_ALL;
	cl_int				deviceId = 0;
	cl_int				platformId = 0;

	//	FFT state

	clfftResultLocation	place = CLFFT_INPLACE;
	clfftLayout	inLayout  = CLFFT_COMPLEX_INTERLEAVED;
	clfftLayout	outLayout = CLFFT_COMPLEX_INTERLEAVED;
	clfftPrecision precision = CLFFT_SINGLE;
	clfftDirection dir = CLFFT_FORWARD;
	size_t lengths[ 3 ] = {1,1,1};
	size_t iStrides[ 4 ] = {0,0,0,0};
	size_t oStrides[ 4 ] = {0,0,0,0};
	cl_uint profile_count = 0;

	cl_uint command_queue_flags = 0;
	size_t batchSize = 1;


	//	Initialize flags for FFT library
	std::auto_ptr< clfftSetupData > setupData( new clfftSetupData );
	OPENCL_V_THROW( clfftInitSetupData( setupData.get( ) ),
		"clfftInitSetupData failed" );

	try
	{
		// Declare the supported options.
		po::options_description desc( "clFFT client command line options" );
		desc.add_options()
			( "help,h",        "produces this help message" )
			( "version,v",     "Print queryable version information from the clFFT library" )
			( "clinfo,i",      "Print queryable information of all the OpenCL runtimes and devices" )
			( "printChosen",   "Print queryable information of the selected OpenCL runtime and device" )
			( "gpu,g",         "Force selection of OpenCL GPU devices only" )
			( "cpu,c",         "Force selection of OpenCL CPU devices only" )
			( "all,a",         "Force selection of all OpenCL devices (default)" )
			( "platform",      po::value< cl_int >( &platformId )->default_value( 0 ),   "Select a specific OpenCL platform id as it is reported by clinfo" )
			( "device",        po::value< cl_int >( &deviceId )->default_value( 0 ),   "Select a specific OpenCL device id as it is reported by clinfo" )
			( "outPlace,o",    "Out of place FFT transform (default: in place)" )
			( "double",		   "Double precision transform (default: single)" )
			( "inv",			"Backward transform (default: forward)" )
			( "dumpKernels,d", "FFT engine will dump generated OpenCL FFT kernels to disk (default: dump off)" )
			( "lenX,x",        po::value< size_t >( &lengths[ 0 ] )->default_value( 1024 ),   "Specify the length of the 1st dimension of a test array" )
			( "lenY,y",        po::value< size_t >( &lengths[ 1 ] )->default_value( 1 ),      "Specify the length of the 2nd dimension of a test array" )
			( "lenZ,z",        po::value< size_t >( &lengths[ 2 ] )->default_value( 1 ),      "Specify the length of the 3rd dimension of a test array" )
			( "isX",   po::value< size_t >( &iStrides[ 0 ] )->default_value( 1 ),						"Specify the input stride of the 1st dimension of a test array" )
			( "isY",   po::value< size_t >( &iStrides[ 1 ] )->default_value( 0 ),	"Specify the input stride of the 2nd dimension of a test array" )
			( "isZ",   po::value< size_t >( &iStrides[ 2 ] )->default_value( 0 ),	"Specify the input stride of the 3rd dimension of a test array" )
			( "iD", po::value< size_t >( &iStrides[ 3 ] )->default_value( 0 ), "input distance between subsequent sets of data when batch size > 1" )
			( "osX",   po::value< size_t >( &oStrides[ 0 ] )->default_value( 1 ),						"Specify the output stride of the 1st dimension of a test array" )
			( "osY",   po::value< size_t >( &oStrides[ 1 ] )->default_value( 0 ),	"Specify the output stride of the 2nd dimension of a test array" )
			( "osZ",   po::value< size_t >( &oStrides[ 2 ] )->default_value( 0 ),	"Specify the output stride of the 3rd dimension of a test array" )
			( "oD", po::value< size_t >( &oStrides[ 3 ] )->default_value( 0 ), "output distance between subsequent sets of data when batch size > 1" )
			( "batchSize,b",   po::value< size_t >( &batchSize )->default_value( 1 ), "If this value is greater than one, arrays will be used " )
			( "profile,p",     po::value< cl_uint >( &profile_count )->default_value( 1 ), "Time and report the kernel speed of the FFT (default: profiling off)" )
			( "inLayout",      po::value< clfftLayout >( &inLayout )->default_value( CLFFT_COMPLEX_INTERLEAVED ), "Layout of input data:\n1) interleaved\n2) planar\n3) hermitian interleaved\n4) hermitian planar\n5) real" )
			( "outLayout",     po::value< clfftLayout >( &outLayout )->default_value( CLFFT_COMPLEX_INTERLEAVED ), "Layout of input data:\n1) interleaved\n2) planar\n3) hermitian interleaved\n4) hermitian planar\n5) real" )
			;

		po::variables_map vm;
		po::store( po::parse_command_line( argc, argv, desc ), vm );
		po::notify( vm );

		if( vm.count( "version" ) )
		{
			const int indent = countOf( "clFFT client API version: " );
			tout << std::left << std::setw( indent ) << _T( "clFFT client API version: " )
				<< clfftVersionMajor << _T( "." )
				<< clfftVersionMinor << _T( "." )
				<< clfftVersionPatch << std::endl;

			cl_uint libMajor, libMinor, libPatch;
			clfftGetVersion( &libMajor, &libMinor, &libPatch );

			tout << std::left << std::setw( indent ) << _T( "clFFT runtime version: " )
				<< libMajor << _T( "." )
				<< libMinor << _T( "." )
				<< libPatch << std::endl << std::endl;
		}

		if( vm.count( "help" ) )
		{
			//	This needs to be 'cout' as program-options does not support wcout yet
			std::cout << desc << std::endl;
			return 0;
		}

		size_t mutex = ((vm.count( "gpu" ) > 0) ? 1 : 0)
			| ((vm.count( "cpu" ) > 0) ? 2 : 0)
			| ((vm.count( "all" ) > 0) ? 4 : 0);
		if ((mutex & (mutex-1)) != 0) {
			terr << _T("You have selected mutually-exclusive OpenCL device options:") << std::endl;
			if (vm.count ( "gpu" )  > 0) terr << _T("    gpu,g   Force selection of OpenCL GPU devices only" ) << std::endl;
			if (vm.count ( "cpu" )  > 0) terr << _T("    cpu,c   Force selection of OpenCL CPU devices only" ) << std::endl;
			if (vm.count ( "all" )  > 0) terr << _T("    all,a   Force selection of all OpenCL devices (default)" ) << std::endl;
			return 1;
		}

		if( vm.count( "gpu" ) )
		{
			deviceType	= CL_DEVICE_TYPE_GPU;
		}

		if( vm.count( "cpu" ) )
		{
			deviceType	= CL_DEVICE_TYPE_CPU;
		}

		if( vm.count( "all" ) )
		{
			deviceType	= CL_DEVICE_TYPE_ALL;
		}

		if( vm.count( "clinfo" ) )
		{
			std::vector< cl_platform_id > platformInfos;
			std::vector< std::vector< cl_device_id > > deviceInfos;
			discoverCLPlatforms( deviceType, platformInfos, deviceInfos );
			prettyPrintCLPlatforms(platformInfos, deviceInfos);
			return 0;
		}

		bool printInfo = false;
		if( vm.count( "printChosen" ) )
		{
			printInfo = true;
		}

		if( vm.count( "outPlace" ) )
		{
			place = CLFFT_OUTOFPLACE;
		}

		if( vm.count( "double" ) )
		{
			precision = CLFFT_DOUBLE;
		}

		if( vm.count( "inv" ) )
		{
			dir = CLFFT_BACKWARD;
		}

		if( profile_count > 1 )
		{
			command_queue_flags |= CL_QUEUE_PROFILING_ENABLE;
		}

		if( vm.count( "dumpKernels" ) )
		{
			setupData->debugFlags	|= CLFFT_DUMP_PROGRAMS;
		}

		int inL = (int)inLayout;
		int otL = (int)outLayout;

		// input output layout support matrix
		int ioLayoutSupport[5][5] =		{
										{ 1, 1, 0, 0, 1 },
										{ 1, 1, 0, 0, 1 },
										{ 0, 0, 0, 0, 1 },
										{ 0, 0, 0, 0, 1 },
										{ 1, 1, 1, 1, 0 },
										};

		if((inL < 1) || (inL > 5)) throw std::runtime_error( "Invalid Input layout format" );
		if((otL < 1) || (otL > 5)) throw std::runtime_error( "Invalid Output layout format" );

		if(ioLayoutSupport[inL-1][otL-1] == 0) throw std::runtime_error( "Invalid combination of Input/Output layout formats" );

		if( ((inL == 1) || (inL == 2)) && ((otL == 1) || (otL == 2)) ) // Complex-Complex cases
		{
			iStrides[1] = iStrides[1] ? iStrides[1] : lengths[0] * iStrides[0];
			iStrides[2] = iStrides[2] ? iStrides[2] : lengths[1] * iStrides[1];
			iStrides[3] = iStrides[3] ? iStrides[3] : lengths[2] * iStrides[2];



			if(place == CLFFT_INPLACE)
			{
				oStrides[0] = iStrides[0];
				oStrides[1] = iStrides[1];
				oStrides[2] = iStrides[2];
				oStrides[3] = iStrides[3];
			}
			else
			{
				oStrides[1] = oStrides[1] ? oStrides[1] : lengths[0] * oStrides[0];
				oStrides[2] = oStrides[2] ? oStrides[2] : lengths[1] * oStrides[1];
				oStrides[3] = oStrides[3] ? oStrides[3] : lengths[2] * oStrides[2];
			}
		}
		else // Real-Complex and Complex-Real cases
		{
			size_t *rst, *cst;
			size_t N = lengths[0];
			size_t Nt = 1 + lengths[0]/2;
			bool iflag = false;
			bool rcFull = (inL == 1) || (inL == 2) || (otL == 1) || (otL == 2);

			if(inLayout == CLFFT_REAL) { iflag = true; rst = iStrides; }
			else { rst = oStrides; } // either in or out should be REAL

			// Set either in or out strides whichever is real
			if(place == CLFFT_INPLACE)
			{
				if(rcFull)	{ rst[1] = rst[1] ? rst[1] :  N * 2 * rst[0]; }
				else		{ rst[1] = rst[1] ? rst[1] : Nt * 2 * rst[0]; }

				rst[2] = rst[2] ? rst[2] : lengths[1] * rst[1];
				rst[3] = rst[3] ? rst[3] : lengths[2] * rst[2];
			}
			else
			{
				rst[1] = rst[1] ? rst[1] : lengths[0] * rst[0];
				rst[2] = rst[2] ? rst[2] : lengths[1] * rst[1];
				rst[3] = rst[3] ? rst[3] : lengths[2] * rst[2];
			}

			// Set the remaining of in or out strides that is not real
			if(iflag) { cst = oStrides; }
			else	  { cst = iStrides; }

			if(rcFull)	{ cst[1] = cst[1] ? cst[1] :  N * cst[0]; }
			else		{ cst[1] = cst[1] ? cst[1] : Nt * cst[0]; }

			cst[2] = cst[2] ? cst[2] : lengths[1] * cst[1];
			cst[3] = cst[3] ? cst[3] : lengths[2] * cst[2];
		}

		if( precision == CLFFT_SINGLE )
			transform<float>( lengths, iStrides, oStrides, batchSize, inLayout, outLayout, place, precision, dir, deviceType, deviceId, platformId, printInfo, command_queue_flags, profile_count, setupData );
		else
			transform<double>( lengths, iStrides, oStrides, batchSize, inLayout, outLayout, place, precision, dir, deviceType, deviceId, platformId, printInfo, command_queue_flags, profile_count, setupData );
	}
	catch( std::exception& e )
	{
		terr << _T( "clFFT error condition reported:" ) << std::endl << e.what() << std::endl;
		return 1;
	}
	return 0;
}
Пример #23
0
KMahjonggTilesetSelector::KMahjonggTilesetSelector( QWidget* parent, KConfigSkeleton * aconfig )
        : QWidget( parent )
{
    setupUi(this);
    setupData(aconfig);
}