/**
  * Gives a representative figure of the light level in the current environment
  * where are micro:bit is situated.
  *
  * Internally, it constructs an instance of a MicroBitLightSensor if not already configured
  * and sets the display mode to DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE.
  *
  * This also changes the tickPeriod to MICROBIT_LIGHT_SENSOR_TICK_SPEED so
  * that the display does not suffer from artifacts.
  *
  * @return an indicative light level in the range 0 - 255.
  *
  * @note this will return 0 on the first call to this method, a light reading
  * will be available after the display has activated the light sensor for the
  * first time.
  */
int MicroBitDisplay::readLightLevel()
{
    if(mode != DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE)
    {
        setDisplayMode(DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE);
        this->lightSensor = new MicroBitLightSensor(matrixMap);
    }

    return this->lightSensor->read();
}
Beispiel #2
0
void MoviesMainForm::updateAfterLookup(LookupManager& lookupManager)
{
    std::for_each(movies.begin(), movies.end(), ObjectDeleter<Movie>());
    movies.clear();
    theatres = &lookupManager.moviesData;
    theatresList_.notifyItemsChanged();
    moviesList_.notifyItemsChanged();            
    setDisplayMode(invisibleDisplayMode_);
    updateMoviesTitle();
    update();
}
Beispiel #3
0
void MoviesMainDialog::showMovie(ulong_t index)
{
    DefinitionModel* model = MoviesPrepareMovie(movies_, index);
    if (NULL == model)
    {
        Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
        return;
    }
    renderer_.setModel(model, Definition::ownModel);
    setDisplayMode(showMovieDetails);
}
Beispiel #4
0
SaxsviewMask::SaxsviewMask(QObject *parent)
 : QObject(parent), QwtPlotSpectrogram(), p(new Private) {

  // The mask shall be "above" the image.
  setZ(10);

  // TODO: make initial mask color configurable (save the last mask color?)
  setColor(QColor(255, 0, 255, 128));

  setDisplayMode(QwtPlotSpectrogram::ImageMode, true);
}
Beispiel #5
0
void PediaMainForm::changeLanguage(const char_t* code)
{
    PediaPreferences& prefs = application().preferences().pediaPrefs;
    if (0 != tstrcmp(code, prefs.languageCode))
    {
        prefs.articleCount = prefs.articleCountNotChecked;
        memmove(prefs.languageCode, code, tstrlen(code) * sizeof(char_t));
        prefs.dbDate[0] = '\0';
    }
    setDisplayMode(showAbout);
    update();
}
Beispiel #6
0
PlotSpectr::PlotSpectr()
{
    setRenderThreadCount(0);  // use system specific thread count

    QList<double> contourLevels;
    contourLevels += 0.99;
    setContourLevels( contourLevels );

    setAlpha(0);
    setDisplayMode( QwtPlotSpectrogram::ContourMode, true );
    setCachePolicy( QwtPlotRasterItem::PaintCache );
    setRenderHint(QwtPlotItem::RenderAntialiased);
}
    int DisplayDispatcher::setDispProp(int cmd,int param0,int param1,int param2)
    {
        switch(cmd)
        {
            case  DISPLAY_CMD_SETDISPPARA:
                return  setDisplayParameter(param0,param1,param2);

            case  DISPLAY_CMD_CHANGEDISPMODE:
                return  changeDisplayMode(param0,param1,param2);

            case  DISPLAY_CMD_CLOSEDISP:
                return  closeDisplay(param0);

            case  DISPLAY_CMD_OPENDISP:
                return  openDisplay(param0);

            case  DISPLAY_CMD_GETDISPCOUNT:
                return  getDisplayCount();

            case DISPLAY_CMD_GETDISPLAYMODE:
                return  getDisplayMode();

            case DISPLAY_CMD_GETDISPPARA:
                return  getDisplayParameter(param0,param1);

            case DISPLAY_CMD_GETHDMISTATUS:
                return  getHdmiStatus();

            case DISPLAY_CMD_GETMASTERDISP:
                return  getMasterDisplay();

            case DISPLAY_CMD_GETMAXHDMIMODE:
                return  getMaxHdmiMode();

            case DISPLAY_CMD_GETMAXWIDTHDISP:
                return  getMaxWidthDisplay();

            case DISPLAY_CMD_GETTVSTATUS:
                return  getTvDacStatus();

            case DISPLAY_CMD_SETMASTERDISP:
                return  setMasterDisplay(param0);

            case DISPLAY_CMD_SETDISPMODE:
                return  setDisplayMode(param0);

            default:
                LOGE("Display Cmd not Support!\n");
                return  -1;
        }
    }
Beispiel #8
0
void PediaMainForm::handleLookupFinished(const EventType& event)
{
    setControlsState(true);
    const LookupFinishedEventData& data=reinterpret_cast<const LookupFinishedEventData&>(event.data);
    switch (data.outcome)
    {
        case data.outcomeArticleBody:
            updateAfterLookup();
            break;

        case data.outcomeList:
            Application::popupForm(searchResultsForm);
            break;

        case data.outcomeDatabaseSwitched:
            // recalc about info and show about screen
            setDisplayMode(showAbout);            
            termInputField_.replace("");
            update();
            break;

        case data.outcomeAvailableLangs:
            assert(!app().preferences().availableLangs.empty());
            if (app().preferences().availableLangs.empty())
            {
                // this shouldn't happen but if it does, we want to break
                // to avoid infinite loop (changeDatabase() will issue request
                // to get available langs whose result we handle here
                break;
            }
            changeDatabase();
            break;

        case data.outcomeNotFound:
            termInputField_.select();
            // No break is intentional.

        default:
            update();
    }

    LookupManager* lookupManager=app().getLookupManager();
    assert(lookupManager);
    lookupManager->handleLookupFinishedInForm(data);

    if (app().inStressMode())
    {
        EvtResetAutoOffTimer();
        randomArticle();
    }        
}
Beispiel #9
0
void initLCD(){
    //initialize test values
    LATF = 0;
    LATE = 0;
    TRISF = 0;
    TRISE = 0;

    //Open Drain Controls
    ODCE = 0x00;
    ODCF = 0x00;

    //set LCD control output enables
    TRISFbits.TRISF0 = 0; //RF0 output
    TRISFbits.TRISF5 = 0; //RF5 output
    TRISDbits.TRISD0 = 0; //RD0 output
    TRISDbits.TRISD5 = 0; //RD5 output
    TRISDbits.TRISD9 = 0;//RD9 output
    TRISDbits.TRISD10 = 0; //RD10 output
    TRISDbits.TRISD11 = 0; //RD11 output

    //LCD Init
    LCDHALT = 1;
    LCDCE = 1;
    LCDCD = 1;
    LCDRD = 1;
    LCDWR = 1;
    LCDRST = 0;
    delayMs(50);
    LCDRST = 1;
    delayMs(50);

    setTextHome(); //map text memory
    setTextArea(); //map
    setGraphicHome();
    setGraphicArea();
    setMode();
    setCursorPattern();
    setDisplayMode(); //works


    clearDisplay(); //why isn't the display clearing
    setAddrPointer( 0x00 , 0x00 );

    //PrintStockInfo("ATVI", 122.72,2.81, 22.8);

    delayMs(50);
    LCDCE = 0; //enable chip
    delayMs(5000);

}
Beispiel #10
0
void EditableLabel::doInit() {
	QStackedLayout *layout=new QStackedLayout();

	layout->setSpacing(0);
	layout->setMargin(0);
	text=new QLabel(this);
	edit=new FilterLineEdit(this);
//	text->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
//	edit->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Minimum);
//	setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
//	edit->setMinimumWidth(10);
//	text->setMinimumWidth(10);
//	setMinimumWidth(10);
	edit->setMaximumWidth(90);
	layout->addWidget(text);
	layout->addWidget(edit);
	layout->setCurrentIndex(0);
	setLayout(layout);
	QObject::connect(edit,SIGNAL(editingFinished()),this,SLOT(setDisplayMode()));
	QObject::connect(edit,SIGNAL(lostFocus()),this,SLOT(setDisplayMode()));
//	QObject::connect(text,SIGNAL(doubleclicked()),this,SLOT(setEditMode()));
	editing=false;
}
Beispiel #11
0
bool SceneUiState::copyFrom(const FunctionUiState* uiState)
{
    if (uiState == NULL)
        return false;

    const SceneUiState * s = qobject_cast<const SceneUiState *>(uiState);
    if (s)
    { 
         setDisplayMode(s->displayMode());
         setCurrentTab(s->currentTab());
    }

    return FunctionUiState::copyFrom(uiState);
}
Beispiel #12
0
void PediaMainForm::updateAfterLookup()
{
    LookupManager* lookupManager = app().getLookupManager();
    assert(lookupManager!=0);
    if (lookupManager)
    {
        articleRenderer_.setModel(lookupManager->lastDefinitionModel, Definition::ownModelNot);
        setDisplayMode(showArticle);
        
        termInputField_.replace(lookupManager->lastSearchTerm());
        termInputField_.select();                    
        articleRenderer_.focus();
        update();
    }
    updateNavigationButtons();
}
Beispiel #13
0
int main( int argc, char *argv[] ){
    unsigned int displayMode;
    int entries;
    struct fileInfo ** table_ptr =\
                (struct fileInfo**) malloc(sizeof(struct fileInfo**));
    
    /* Check if allocation is successful*/
    if (table_ptr == NULL) {
        perror(STR_ALLOC_ERR);
        exit(1);
    }
    
    *table_ptr = (struct fileInfo*) malloc(sizeof(struct fileInfo*));
    
    /* Check if allocation is successful*/
    if (*table_ptr == NULL) {
        perror(STR_ALLOC_ERR);
        exit(1);
    }
    
    // Set display mode
    displayMode = setDisplayMode(argc, argv);
    
    /* Check for error flag of display mode*/
    if (displayMode & ERR_FLAG) {
        (void) fprintf(stderr, STR_USAGE, argv[0]);
        exit(1);
    }
    
    
    if (argv[optind] == NULL) { // No files specified in command line
        
        // Build the file info table and the number of entries
        entries = buildFileInfoTable(".", table_ptr);
        // Display the file info
        displayFileInfo(*table_ptr, entries, displayMode);
        free(*table_ptr);
    } else {    // files specified in command line
        while (argv[optind] != NULL) {  // Keeps reading multiple files
            entries = buildFileInfoTable(argv[optind++], table_ptr);
            displayFileInfo(*table_ptr, entries, displayMode);
            free(*table_ptr);
        }
    }
    free(table_ptr);
    return 0;
}
Beispiel #14
0
void manager::printTime(QString state){
//    if (!checkIfLockedAndBlank())
    if (state=="open"){
        if (checkIfLockedAndBlank()){
            qDebug()<<"let's start dancing";
            pressPowerTimer->start();
            keepTkLockOn->start();
            pressPower();
        }
    } else {
        qDebug()<<"stop and lock";
        pressPowerTimer->stop();
        keepTkLockOn->stop();
        if (checkIfLocked()) setDisplayMode("off");
    }

}
Beispiel #15
0
CpuWidget::CpuWidget(QWidget *parent) :
    PerformanceWidget(parent), m_dataQuery(CpuDataQuery()),
  m_displayMode(DRAW_GRAPH),m_multi(true),m_index(0)

{
    //Set what data quary we want
    setDataQuery(&m_dataQuery);
    //set data query default config
    m_dataQuery.setMulti(m_multi);
    m_dataQuery.setIndex(m_index);

    //Let s initialize all the painters
    m_graphP = new GraphPainter(this);
    m_multiP = new GraphMultiColorPainter(this);
    m_barsP =  new BarsPainter(this);
    //Initialize painter
    setDisplayMode(DRAW_GRAPH_MULTI_COLOR);
}
Beispiel #16
0
void Pulsars::readSettingsFromConfig(void)
{
	conf->beginGroup("Pulsars");

	updateUrl = conf->value("url", "https://stellarium.org/json/pulsars.json").toString();
	updateFrequencyDays = conf->value("update_frequency_days", 100).toInt();
	lastUpdate = QDateTime::fromString(conf->value("last_update", "2012-05-24T12:00:00").toString(), Qt::ISODate);
	updatesEnabled = conf->value("updates_enabled", true).toBool();
	setDisplayMode(conf->value("distribution_enabled", false).toBool());
	setGlitchFlag(conf->value("use_separate_colors", false).toBool());
	setFilteredMode(conf->value("filter_enabled", false).toBool());
	setFilterValue(conf->value("filter_value", 150.f).toFloat());
	setMarkerColor(StelUtils::strToVec3f(conf->value("marker_color", "0.4,0.5,1.0").toString()));
	setGlitchColor(StelUtils::strToVec3f(conf->value("glitch_color", "0.2,0.3,1.0").toString()));
	enableAtStartup = conf->value("enable_at_startup", false).toBool();
	flagShowPulsarsButton = conf->value("flag_show_pulsars_button", true).toBool();

	conf->endGroup();
}
Beispiel #17
0
bool MoviesMainForm::handleOpen()
{
    bool res = MoriartyForm::handleOpen();
    MoriartyApplication& app = application();
    LookupManager* lookupManager = app.lookupManager;
    assert(NULL != lookupManager);
    theatres = &lookupManager->moviesData;
    theatresList_.notifyItemsChanged();

    setDisplayMode(displayMode_);
    if (theatres->empty()  && !app.preferences().moviesLocation.empty())
        sendEvent(MoriartyApplication::appFetchMoviesEvent);
    else if (app.preferences().moviesLocation.empty())
        Application::popupForm(changeLocationForm);
    else
        updateMoviesTitle();
        
    return res;
}
Beispiel #18
0
Lamp::Lamp(unsigned char ledPin, unsigned char audioPin)
{

  _menuIndex =0x0;
  _menuDepth = 0;

  this->lpin = ledPin;
  this->audPin = audioPin;
  this->LEDCycleRising = true;
  this->LEDPWM = 0;
  this->cycleStep = 1;  
  this->_sleeping = false;
  this->_lampOn = true;
  fadeTimer = Metro(1);

  _alarming = false;
  tAlarmStarted = 128;

  //Default Values if Lamp is starting for the first time
  if (!isInit())
  {
    setDisplayMode(0x1);
    setAlarmAM(true);
    setAlarmHour(7);
    setAlarmMin(30);
    setAlarmOn(false);

    //setLCDBrightness(255);
    setLampBrightness(128);
    setCycleFadeTime(15);
    setCycleHoldTime(15);
    setCycleSteps(15);
    setRandomFadeTime(15);
    setRandomHoldTime(15);
    setColorHue(150);
    setColorSat(150);

  }

  drawMenu(menuPosition());
}
Beispiel #19
0
MapBox::MapBox(MainWindow * parent) :
    QWidget(parent),
    m_qgv(0),
    m_scene(0),
    m_mapWidget(0),
    m_serviceProvider(0),
    m_mapManager(0),
    m_connectivityMode(QGraphicsGeoMap::HybridMode),
    m_popupMenu(0),
    m_popupMenuMapObject(0),
    m_displayMode(DisplayNone),
    m_optionsWidget(0)
{
    for (QVariantHash::const_iterator it = parent->programOptions().begin(); it != parent->programOptions().end(); ++it)
    {
        m_parameters.insert(it.key(), it.value());
    }

    m_scene = new QGraphicsScene(this);

    m_qgv = new QGraphicsView(m_scene, this);
    m_qgv->setOptimizationFlag(QGraphicsView::IndirectPainting, true);
    m_qgv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_qgv->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_qgv->setFrameShape(QFrame::NoFrame);

    m_optionsButton = new QPushButton("Options", m_qgv);
    m_optionsButton->resize(m_optionsButton->sizeHint());
    connect(m_optionsButton, SIGNAL(clicked()), this, SLOT(showOptions()));

    QVBoxLayout * layout = new QVBoxLayout(this);
    layout->setMargin(0);
    setLayout(layout);
    setDisplayMode(DisplayMap);

    createDialogs();
    createPixmapIcon();
}
Beispiel #20
0
bool MoviesMainDialog::handleLookupFinished(Event& event, const LookupFinishedEventData* data)
{
    LookupManager* lm = GetLookupManager();
    Preferences& prefs = *GetPreferences();
    switch (data->result)
    {
    case lookupResultMoviesData:
    {
        PassOwnership(lm->udf, udf_);
        assert(NULL != udf_);
        clearMovies();
        prepareTheatresList();
        setDisplayMode(showTheatres);
        return messageHandled;
    }
        
    case lookupResultLocationUnknown:
    {
        char_t* loc = StringCopy(prefs.moviesLocation);
        if (NULL == loc)
        {
            Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
            return messageHandled;
        }
        ModuleDialog::handleLookupFinished(event, data);
        if (IDOK == ChangeLocationDialog::showModal(loc, handle()))
        {
            free(prefs.moviesLocation);
            prefs.moviesLocation = loc;
            if (NULL != prefs.moviesLocation)
                MoviesFetchData();
        }
        return messageHandled;
    }

    }
    return ModuleDialog::handleLookupFinished(event, data);
}
TimeDisplayWidget::TimeDisplayWidget() :
	QWidget(),
	m_displayMode( MinutesSeconds ),
	m_spinBoxesLayout( this ),
	m_majorLCD( 3, this ),
	m_minorLCD( 3, this ),
	m_milliSecondsLCD( 3, this )
{
	m_spinBoxesLayout.setSpacing( 0 );
	m_spinBoxesLayout.setMargin( 0 );
	m_spinBoxesLayout.addWidget( &m_majorLCD );
	m_spinBoxesLayout.addWidget( &m_minorLCD );
	m_spinBoxesLayout.addWidget( &m_milliSecondsLCD );

	setMaximumHeight( 32 );

	toolTip::add( this, tr( "click to change time units" ) );

	// update labels of LCD spinboxes
	setDisplayMode( m_displayMode );

	connect( engine::mainWindow(), SIGNAL( periodicUpdate() ),
					this, SLOT( updateTime() ) );
}
Beispiel #22
0
//=============================================================================
// Call repeatedly by the main message loop in WinMain
//=============================================================================
void Game::run(HWND hwnd)
{
    if(graphics == NULL)            // if graphics not initialized
        return;

    // calculate elapsed time of last frame, save in frameTime
    QueryPerformanceCounter(&timeEnd);
    frameTime = (float)(timeEnd.QuadPart - timeStart.QuadPart ) / (float)timerFreq.QuadPart;

    // Power saving code, requires winmm.lib
    // if not enough time has elapsed for desired frame rate
    if (frameTime < MIN_FRAME_TIME) 
    {
        sleepTime = (DWORD)((MIN_FRAME_TIME - frameTime)*1000);
        timeBeginPeriod(1);         // Request 1mS resolution for windows timer
        Sleep(sleepTime);           // release cpu for sleepTime
        timeEndPeriod(1);           // End 1mS timer resolution
        return;
    }

    if (frameTime > 0.0)
        fps = (fps*0.99f) + (0.01f/frameTime);  // average fps

    if (frameTime > MAX_FRAME_TIME) // if frame rate is very slow
        frameTime = MAX_FRAME_TIME; // limit maximum frameTime

    timeStart = timeEnd;

    // update(), ai(), and collisions() are pure virtual functions.
    // These functions must be provided in the class that inherits from Game.
    if (!paused)                    // if not paused
    {
        update();                   // update all game items
        ai();                       // artificial intelligence
        collisions();               // handle collisions
        input->vibrateControllers(frameTime); // handle controller vibration
    }
    renderGame();                   // draw all game items

    //check for console key
    if (input->wasKeyPressed(CONSOLE_KEY))
    {
        console->showHide();
        paused = console->getVisible(); // pause game when console is visible
    }
    consoleCommand();               // process user entered console command

    input->readControllers();       // read state of controllers

    messageDialog->update();
    inputDialog->update();

    audio->run();                   // perform periodic sound engine tasks

    // if Alt+Enter toggle fullscreen/window
    if (input->isKeyDown(ALT_KEY) && input->wasKeyPressed(ENTER_KEY))
        setDisplayMode(graphicsNS::TOGGLE); // toggle fullscreen/window

    // if Esc key, set window mode
    if (input->isKeyDown(ESC_KEY))
        setDisplayMode(graphicsNS::WINDOW); // set window mode

    // Clear input
    // Call this after all key checks are done
    input->clear(inputNS::KEYS_PRESSED);
}
Beispiel #23
0
    int DisplayDispatcher::setDispProp(int cmd,int param0,int param1,int param2)
    {
        switch(cmd)
        {
            case  DISPLAY_CMD_SETDISPPARA:
                return  setDisplayParameter(param0,param1,param2);

            case  DISPLAY_CMD_CHANGEDISPMODE:
                return  mDevice->changemode(mDevice,param0,param1,param2);

            case  DISPLAY_CMD_CLOSEDISP:
                return  mDevice->closedisplay(mDevice,param0);

            case  DISPLAY_CMD_OPENDISP:
                return  mDevice->opendisplay(mDevice,param0);

            case  DISPLAY_CMD_GETDISPCOUNT:
                return  mDevice->getdisplaycount(mDevice);

            case DISPLAY_CMD_GETDISPLAYMODE:
                return  mDevice->getdisplaymode(mDevice);

            case DISPLAY_CMD_GETDISPPARA:
                return  mDevice->getdisplayparameter(mDevice,param0,param1);

            case DISPLAY_CMD_GETHDMISTATUS:
                return  mDevice->gethdmistatus(mDevice);

            case DISPLAY_CMD_GETMASTERDISP:
                return  mDevice->getmasterdisplay(mDevice);

            case DISPLAY_CMD_GETMAXHDMIMODE:
                return  mDevice->gethdmimaxmode(mDevice);

            case DISPLAY_CMD_GETMAXWIDTHDISP:
                return  mDevice->getmaxwidthdisplay(mDevice);

            case DISPLAY_CMD_GETTVSTATUS:
                return  mDevice->gettvdacstatus(mDevice);

            case DISPLAY_CMD_SETMASTERDISP:
                return  mDevice->setmasterdisplay(mDevice,param0);

            case DISPLAY_CMD_SETDISPMODE:
                return  setDisplayMode(param0);

            case DISPLAY_CMD_SETBACKLIGHTMODE:
                return  mDevice->setdisplaybacklightmode(mDevice,param0);

            case DISPLAY_CMD_SETORIENTATION:
                return mDevice->setOrientation(mDevice,param0);

            case DISPLAY_CMD_ISSUPPORTHDMIMODE:
                return mDevice->issupporthdmimode(mDevice,param0);

            case DISPLAY_CMD_SETAREAPERCENT:
                return mDevice->setdisplayareapercent(mDevice,param0,param1);

            case DISPLAY_CMD_GETAREAPERCENT:
                return mDevice->getdisplayareapercent(mDevice,param0);

            case DISPLAY_CMD_SETBRIGHT:
                return mDevice->setdisplaybrightness(mDevice,param0,param1);

            case DISPLAY_CMD_GETBRIGHT:
                return mDevice->getdisplaybrightness(mDevice,param0);

            case DISPLAY_CMD_SETCONTRAST:
                return mDevice->setdisplaycontrast(mDevice,param0,param1);

            case DISPLAY_CMD_GETCONTRAST:
                return mDevice->getdisplaycontrast(mDevice,param0);

            case DISPLAY_CMD_SETSATURATION:
                return mDevice->setdisplaysaturation(mDevice,param0,param1);

            case DISPLAY_CMD_GETSATURATION:
                return mDevice->getdisplaysaturation(mDevice,param0);

            case DISPLAY_CMD_SETHUE:
                return mDevice->setdisplayhue(mDevice,param0,param1);

            case DISPLAY_CMD_GETHUE:
                return mDevice->getdisplayhue(mDevice,param0);

            case DISPLAY_CMD_STARTWIFIDISPLAYSEND:
                return  startWifiDisplaySend(param0,param1);

            case DISPLAY_CMD_ENDWIFIDISPLAYSEND:
                return  endWifiDisplaySend(param0);

            case DISPLAY_CMD_STARTWIFIDISPLAYRECEIVE:
                return  startWifiDisplayReceive(param0,param1);

            case DISPLAY_CMD_ENDWIFIDISPLAYRECEIVE:
                return  endWifiDisplayReceive(param0);

            case DISPLAY_CMD_UPDATESENDCLIENT:
                return  updateSendClient(param0);

            case DISPLAY_CMD_SETCONVERTFBID:
                return  setConvertBufId(param0);

            case DISPLAY_CMD_SET3DMODE:
                return  mDevice->setdisplay3dmode(mDevice,param0,param1);
            case DISPLAY_CMD_SET3DLAYEROFFSET:
                return  mDevice->set3dlayeroffset(mDevice,param0,param1,param2);

            default:
                ALOGE("Display Cmd not Support!\n");
                return  -1;
        }
    }
Beispiel #24
0
void MapBox::connectivityModeToggled(int type)
{
    m_mapWidget->setConnectivityMode((QGraphicsGeoMap::ConnectivityMode)type);
    setDisplayMode(DisplayMap);
}
Beispiel #25
0
void MapBox::mapTypeToggled(int type)
{
    m_mapWidget->setMapType((QGraphicsGeoMap::MapType)type);
    setDisplayMode(DisplayMap);
}
Beispiel #26
0
void MapBox::showOptions()
{
    setDisplayMode(DisplayOptions);
}
Beispiel #27
0
void MapBox::createOptionsDialog()
{
    if (m_optionsWidget)
        delete m_optionsWidget;
    m_optionsWidget = new QWidget(this);
    QGridLayout * optionsLayout = new QGridLayout;

    QVector<QString> mapTypeNames;
    QVector<QGraphicsGeoMap::MapType> mapControlTypes;

    mapControlTypes.append(QGraphicsGeoMap::StreetMap);         mapTypeNames.append(tr("Street"));
    mapControlTypes.append(QGraphicsGeoMap::SatelliteMapDay);   mapTypeNames.append(tr("Satellite"));
    mapControlTypes.append(QGraphicsGeoMap::SatelliteMapNight); mapTypeNames.append(tr("Satellite - Night"));
    mapControlTypes.append(QGraphicsGeoMap::TerrainMap);        mapTypeNames.append(tr("Terrain"));

    {
        // map types
        QSignalMapper * mapper = new QSignalMapper(m_optionsWidget);
        connect(mapper, SIGNAL(mapped(int)), this, SLOT(mapTypeToggled(int)));

        QLabel * mapTypesLabel = new QLabel(tr("Map types"));

        mapTypesLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
        mapTypesLabel->setAlignment(Qt::AlignHCenter);

        optionsLayout->addWidget(mapTypesLabel, 0, 0);
        QList<QGraphicsGeoMap::MapType> types = m_mapWidget->supportedMapTypes();
        for (int controlIndex = 0; controlIndex < mapControlTypes.size(); ++controlIndex) {
            QPushButton *button = new QPushButton(mapTypeNames[controlIndex], m_optionsWidget);
            button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
            QFont font = button->font();
            font.setPointSize(24);
            button->setFont(font);

            optionsLayout->addWidget(button, controlIndex+1, 0);
            int supportedTypeIndex = types.indexOf(mapControlTypes[controlIndex]);

            if (supportedTypeIndex == -1) {
                button->setEnabled(false);
            } else {
                connect(button, SIGNAL(clicked()), mapper, SLOT(map()));
                mapper->setMapping(button, mapControlTypes[controlIndex]);

                button->setEnabled(true);
                //button->setChecked(mapControlTypes[controlIndex] == m_mapWidget->mapType());
            }

        }
    }
    {
        // connectivity modes
        QVector<QString> connectivityModeNames;
        QVector<QGraphicsGeoMap::ConnectivityMode> connectivityModes;

        connectivityModes.append(QGraphicsGeoMap::NoConnectivity); connectivityModeNames.append(tr("No connectivity"));
        connectivityModes.append(QGraphicsGeoMap::OfflineMode);    connectivityModeNames.append(tr("Offline"));
        connectivityModes.append(QGraphicsGeoMap::OnlineMode);     connectivityModeNames.append(tr("Online"));
        connectivityModes.append(QGraphicsGeoMap::HybridMode);     connectivityModeNames.append(tr("Hybrid"));

        // map types
        QSignalMapper * mapper = new QSignalMapper(m_optionsWidget);
        connect(mapper, SIGNAL(mapped(int)), this, SLOT(connectivityModeToggled(int)));

        QLabel * connectivityModesLabel = new QLabel(tr("Connectivity"));

        connectivityModesLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
        connectivityModesLabel->setAlignment(Qt::AlignHCenter);

        optionsLayout->addWidget(connectivityModesLabel, 0, 1);
        QList<QGraphicsGeoMap::ConnectivityMode> modes = m_mapWidget->supportedConnectivityModes();
        for (int controlIndex = 0; controlIndex < connectivityModes.size(); ++controlIndex) {
            QPushButton *button = new QPushButton(connectivityModeNames[controlIndex], m_optionsWidget);
            button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
            QFont font = button->font();
            font.setPointSize(24);
            button->setFont(font);

            optionsLayout->addWidget(button, controlIndex+1, 1);
            int supportedTypeIndex = modes.indexOf(connectivityModes[controlIndex]);

            if (supportedTypeIndex == -1) {
                button->setEnabled(false);
            } else {
                connect(button, SIGNAL(clicked()), mapper, SLOT(map()));
                mapper->setMapping(button, connectivityModes[controlIndex]);

                button->setEnabled(true);
                //button->setChecked(connectivityModes[controlIndex] == m_mapWidget->connectivityMode());
            }

        }
    }

    /*
    {
        // plugins, TODO
        QList<QString> providers = QGeoServiceProvider::availableServiceProviders();

        for (int i = 0; i < providers.count(); ++i) {
            QAction *providerAction = new QAction(providers[i], this);
            providerAction->setCheckable(true);
            providerAction->setChecked(i == 0);
            m_pluginMenu->addAction(providerAction);
        }
    }
    */

    m_optionsWidget->setLayout(optionsLayout);

    if (displayMode() == DisplayOptions) {
        setDisplayMode(DisplayNone);
        setDisplayMode(DisplayOptions);
    }
}
Beispiel #28
0
void PediaMainForm::handleLookupFinished(const EventType& event)
{
    MoriartyApplication& app = application();
    LookupManager* lookupManager = app.lookupManager;
    assert(NULL != lookupManager);

    const LookupFinishedEventData& data = reinterpret_cast<const LookupFinishedEventData&>(event.data);
    CDynStr str;

    switch (data.result)
    {
        case lookupResultPediaArticle:
            ReplaceCharP(&articleTitle_, lookupManager->lastPediaArticleTitle);
            lookupManager->lastPediaArticleTitle = NULL;

            ReplaceCharP(&searchTerm_, StringCopy2(articleTitle_));

            historySupport_.lookupFinished(true, articleTitle_);
            FinishCrossModuleLookup(historySupport_, pediaModuleName);
            setDisplayMode(showArticle);
            update();
            break;

        case lookupResultPediaSearch:
            ReplaceCharP(&searchTitle_, lookupManager->lastPediaArticleTitle);
            lookupManager->lastPediaArticleTitle = NULL;

            if (NULL == str.AppendCharP3("Search for '", searchTitle_, "'"))
            {
                app.alert(notEnoughMemoryAlert);
                return;
            }

            ReplaceCharP(&searchTerm_, StringCopy2(searchTitle_));

            historySupport_.lookupFinished(true, str.GetCStr());
            FinishCrossModuleLookup(historySupport_, pediaModuleName);

            setDisplayMode(showSearchResults);
            update();
            break;

        case lookupResultPediaLanguages:
            assert(!lookupManager->crossModuleLookup);
            clearLangCodes();
            if (NULL != lookupManager->lastPediaLanguages)
                availLangCodes_ = ExtractLangCodesFromElements(lookupManager->lastPediaLanguages->elements, availLangCodesCount_);
            setDisplayMode(showLanguages);
            update();
            break;

        case lookupResultPediaStats:
            //assert(!lookupManager->crossModuleLookup);
            if (showAbout == displayMode_)
            {
                prepareAbout();
                update();
            }
            break;

        default:
            if (HandleCrossModuleLookup(event, pediaHistoryCacheName, pediaModuleName))
                return;

            assert(!lookupManager->crossModuleLookup);
            update();
    }
    lookupManager->handleLookupFinishedInForm(data);
}
Beispiel #29
0
bool PediaMainForm::handleMenuCommand(UInt16 itemId)
{
    MoriartyApplication& app = application();
    LookupManager& lm = *app.lookupManager;

    switch (itemId)
    {
        case mainPageMenuItem:
            doneButton_.hit();
            return true;

        case searchMenuItem:
            searchButton_.hit();
            return true;

        case randomArticleMenuItem:
            randomArticle();
            return true;

        case searchResultsMenuItem:
            if (showSearchResults == displayMode_)
                return true;

            if (NULL == lm.lastPediaSearchResults)
            {
                app.alert(pediaNoSearchResultsAlert);
                return true;
            }

            setDisplayMode(showSearchResults);
            update();
            return true;

        case homeMenuItem:
            if (showAbout == displayMode_)
                return true;

            setDisplayMode(showAbout);
            update();
            return true;

        case copyMenuItem:
            if (showArticle != displayMode_)
                return true;
            articleRenderer_.copySelectionOrAll();
            return true;

        case historyMenuItem:
            historyButton_.hit();
            return true;

        case forwardMenuItem:
            historySupport_.moveNext();
            return true;

        case backMenuItem:
            historySupport_.movePrevious();
            return true;

        case linkedArticlesMenuItem:
            if (showLinkedArticles == displayMode_)
                return true;

            if (NULL == lm.lastPediaArticle)
            {
                app.alert(pediaNoArticleAlert);
                return true;
            }
            assert(NULL != lm.lastPediaLinkedArticles);

            setDisplayMode(showLinkedArticles);
            update();
            return true;

        case linkingArticlesMenuItem:
            if (showLinkingArticles == displayMode_)
                return true;

            if (NULL == lm.lastPediaArticle)
            {
                app.alert(pediaNoArticleAlert);
                return true;
            }
            assert(NULL != lm.lastPediaLinkingArticles);

            setDisplayMode(showLinkingArticles);
            update();
            return true;

        case changeDatabaseMenuItem:
            if (NULL == application().lookupManager->lastPediaLanguages)
            {
                application().lookupManager->fetchUrl(urlSchemaEncyclopediaLangs urlSeparatorSchemaStr);
                return true;                
            }
            setDisplayMode(showLanguages);
            update();
            return true;

#ifdef INTERNAL_BUILD                    
        case toggleStressModeMenuItem:
            assert(false);
            break;
#endif            

        default:
            assert(false);
    }
    return false;
}
Beispiel #30
0
bool PediaMainForm::handleOpen()
{
    bool result = MoriartyForm::handleOpen();
    setDisplayMode(showAbout);
    return result;
}