• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setLocation函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setLocation函数的典型用法代码示例。如果您正苦于以下问题:C++ setLocation函数的具体用法?C++ setLocation怎么用?C++ setLocation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setLocation函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setLocation

void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, int tx, int ty, const IntRect& rect)
{
    // Make sure our dimensions match the rect.
    setLocation(rect.x() - tx, rect.y() - ty);
    setWidth(rect.width());
    setHeight(rect.height());

    if (graphicsContext->paintingDisabled())
        return;

    // Now do the paint.
    RenderObject::PaintInfo paintInfo(graphicsContext, rect, PaintPhaseBlockBackground, false, 0, 0);
    paint(paintInfo, tx, ty);
    paintInfo.phase = PaintPhaseChildBlockBackgrounds;
    paint(paintInfo, tx, ty);
    paintInfo.phase = PaintPhaseFloat;
    paint(paintInfo, tx, ty);
    paintInfo.phase = PaintPhaseForeground;
    paint(paintInfo, tx, ty);
    paintInfo.phase = PaintPhaseOutline;
    paint(paintInfo, tx, ty);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:22,代码来源:RenderScrollbarPart.cpp


示例2: welcome

void welcome(GWindow window)
{
	GRect rectW = newGRect(0, 0, WIDTH, HEIGHT);
    setFilled(rectW, true);
    setColor(rectW, "#008080");
    add(window, rectW);
    
    GLabel labelW = newGLabel("Hello World!!");
    setFont(labelW, "SansSerif-32");
    setLabel(labelW, "Tic-Tac-Toe");
    add(window, labelW);
    double x = WIDTH/2 - getWidth(labelW)/2;
    double y = HEIGHT/2;
    setLocation(labelW, x, y);
    
    // Wait for Click
    waitForClick();
    
    // Remove Welcome Message
    removeGWindow(window, labelW);

}
开发者ID:zafar11235,项目名称:TicTacToe,代码行数:22,代码来源:tic.c


示例3: Read

MonoRecorder::MonoRecorder(bool fromFile) {
	is_truncated = is_processed = false;
	if ( fromFile ) {
		stamped_offset = 0;
		Read(false);
		assertid("OUT1");
		filename = ReadString();
		float t = ReadFloat();
		if ( Datatype::PeakId() == "anim" ) {
			animation = new Animated<gmtl::Point3f>();
		} else {
			setLocation(ReadVec());
			animation = 0;
		}
		std::cout << this->toString();
	} else {
		animation = 0;
		filename = "";
	}
	has_samples = save_processed = false;
	tracks.push_back(new RecorderTrack());
}
开发者ID:aothms,项目名称:ear,代码行数:22,代码来源:MonoRecorder.cpp


示例4: Read

SoundFile::SoundFile() {
	Read(false);
	assertid("SSRC");
	filename = ReadString();
	WaveFile w(filename.c_str());
	data = w.ToFloat();
	sample_owner = true;
	sample_length = w.GetSampleSize();
	if ( !data || !sample_length ) {
		throw DatatypeException("Failed to open sound file " + filename);
	}
	soundfiles[0] = soundfiles[1] = soundfiles[2] = 0;
	data_low = data_mid = data_high = 0;
	mesh = 0;
	animation = 0;
	if ( Datatype::PeakId() == "anim" ) {
		animation = new Animated<gmtl::Point3f>();
	} else if ( Datatype::PeakId() == "mesh" ) {
		Datatype::prefix = " +- " + Datatype::prefix;
		mesh = new Mesh();
		Datatype::prefix = Datatype::prefix.substr(4);
	} else {
		setLocation(ReadPoint());			
	}
	if ( Datatype::PeakId() == "flt4" ) {
		gain = Datatype::ReadFloat();
	} else {
		gain = 1.0f;
	}
	if ( Datatype::PeakId() == "flt4" ) {
		offset = (unsigned int) (Datatype::ReadFloat() * 44100.0f);
	} else {
		offset = 0;
	}
	std::cout << this->toString();
	std::cout << Datatype::stringblock;
	Datatype::stringblock = "";
}
开发者ID:aothms,项目名称:ear,代码行数:38,代码来源:SoundFile.cpp


示例5: getHeadsetJack

MockInputDeviceNode* getHeadsetJack() {
    auto node = new MockInputDeviceNode();
    node->setPath("/dev/input/event3");
    node->setName("apq8064-tabla-snd-card Headset Jack");
    node->setLocation("ALSA");
    // UniqueId not set
    node->setBusType(0);
    node->setVendorId(0);
    node->setProductId(0);
    node->setVersion(0);
    // No keys
    // No relative axes
    // No absolute axes
    node->addSwitch(SW_HEADPHONE_INSERT);
    node->addSwitch(SW_MICROPHONE_INSERT);
    node->addSwitch(SW_LINEOUT_INSERT);
    // ASUS adds some proprietary switches, but we'll only see two of them.
    node->addSwitch(0x0e);  // SW_HPHL_OVERCURRENT
    node->addSwitch(0x0f);  // SW_HPHR_OVERCURRENT
    // No forcefeedback
    node->addInputProperty(INPUT_PROP_DIRECT);
    return node;
}
开发者ID:MIPS,项目名称:hardware-libhardware,代码行数:23,代码来源:InputMocks.cpp


示例6: checkForEvent

/**
 * Detects the paddle based on the location of the mouse pointer
 */
void checkForEvent(Paddle *bat)
{
    GEvent event = getNextEvent(MOUSE_EVENT);
    if (event != NULL)
    {
        if (getEventType(event) == MOUSE_MOVED)
        {
            double xCoordinate = getX(event) - getWidth(bat->paddle) / 2;
            setLocation(bat->paddle, xCoordinate, HEIGHT - PADDLE_HEIGHT - 100);
            
            // mouse moving right
            if (xCoordinate > bat->x)
            {
                strcpy(bat->direction, "right\0");
            }
            else if(xCoordinate < bat->x)
            {
                strcpy(bat->direction, "left\0");
            }
            bat->x = xCoordinate;
        }
    }
}
开发者ID:cjjavellana,项目名称:cs50,代码行数:26,代码来源:breakout.c


示例7: qDebug

bool Shorty::keyReleaseEventHandler(QEvent *event){
    qDebug(shorty_Main()) << "Key relese event. the key is" << ((QKeyEvent*)event)->key()
                          << "Our location is" << getLocation() << "now it'll be" << getLocation()-1;
    pressedKeys -= ((QKeyEvent*)event)->key();
    setLocation(getLocation()-1);
    qDebug(shorty_Main()) << "errorFlag is" << errorFlag;
    if (errorFlag) {
        if (keysPressed == 0) {
            qDebug(shorty_Main()) << "Clearing flag" << getLocation();
            errorFlag = !errorFlag;
            updateText();
        }
        else{
            qDebug(shorty_Main()) << "There are still" << keysPressed << "pressed keys";
            return true;
        }
    }
    else {
        qDebug() << keysPressed << "No errorFlag";
        unPaint(getLocation());
    }
    return true;
}
开发者ID:nim901,项目名称:Shorty,代码行数:23,代码来源:shorty.cpp


示例8: setLocation

CCylinder::CCylinder(float x, float y, float z)
{	
	m_sizeX= x; m_sizeY= y; m_sizeZ= z;
	setLocation(0.0,0.0,0.0);
	m_control= new CCylinderControl(this);
	s= gluNewQuadric();
	d1= gluNewQuadric(); gluQuadricOrientation(d1, GLU_OUTSIDE);
	d2= gluNewQuadric(); gluQuadricOrientation(d1, GLU_INSIDE);
	m_ratio= 1;

	diskATrans= new hduMatrix ( );
	diskBTrans= new hduMatrix ( );

	diskAShape= new CDisk ();
	diskBShape= new CDisk ();

	diskAShape->AddDependant ( this );
	diskAShape->AddDependant ( this );

	customCylinder= new CHapticCylinder ( this );
	diskA= new CHapticDisk ( diskATrans );
	diskB= new CHapticDisk ( diskBTrans );
}
开发者ID:neilforrest,项目名称:protohaptic,代码行数:23,代码来源:Cylinder.cpp


示例9: setType

GameOver::GameOver() {

    setType("GameOver");

    // link to "message" sprite
    ResourceManager &resource_manager = ResourceManager::getInstance();
    Sprite *p_temp_sprite = resource_manager.getSprite("gameover");
    if (!p_temp_sprite) {
        LogManager &log_manager = LogManager::getInstance();
        log_manager.writeLog("GameOver::GameOver(): Warning! Sprite 'gameover' not found");
    } else {
        setSprite(p_temp_sprite);
        setSpriteSlowdown(15);
        setTransparency('#');    // transparent character
        time_to_live = p_temp_sprite->getFrameCount() * 15;
    }

    // put in center of screen
    setLocation(CENTER_CENTER);

    // register for step event
    registerInterest(STEP_EVENT);
}
开发者ID:nileshp87,项目名称:CS4513,代码行数:23,代码来源:GameOver.cpp


示例10: main

int main(void)
{
    GWindow window = newGWindow(320, 240);
    GOval circle = newGOval(0,0,50,50);
    setColor(circle, "RED");
    setFilled(circle, true);
    add(window, circle);
    
    while ( true )
    {
        GEvent event = getNextEvent( MOUSE_EVENT );
        
        if( event != NULL )
        {
            if( getEventType(event) == MOUSE_MOVED )
            {
                double x = getX(event) - getWidth(circle) / 2;
                double y = getY(event) - getWidth(circle) /2;
                setLocation(circle, x, y);
            } 
        }
    }
}
开发者ID:bogdanpetru,项目名称:cs50,代码行数:23,代码来源:cursor.c


示例11: updateScoreboard

/**
 * Updates scoreboard's label, keeping it centered in window.
 */
void updateScoreboard(GWindow window, GLabel label, int points)
{
    // update label
    char s[12];
    sprintf(s, "%i", points);
    if (points == 51)
    {
        setLabel(label, "WIN!");
    }
    else if (points == 0)
    {
        setLabel(label, ":(");
    }
    else 
    {
        setLabel(label, s);
    }
    
    // center label in window
    double x = (getWidth(window) - getWidth(label)) / 2;
    double y = (getHeight(window) - getHeight(label)) / 2;
    setLocation(label, x, y);
}
开发者ID:LasaleFamine,项目名称:CS50x15-16,代码行数:26,代码来源:breakout.c


示例12: setResource

void Path::setLocation( const String &loc )
{
   uint32 pos = loc.find( ":" );
   if ( pos != String::npos )
   {
      if( loc.find( ":", pos + 1 ) != String::npos )
      {
         m_bValid = false;
      }
      else
      {
         setResource( loc.subString( 0, pos ) );
         setLocation( loc.subString( pos + 1 ) );
      }
   }
   else
   {
      if( m_location != loc )
      {
         m_location = loc;

         uint32 pos1 = m_location.find( "\\" );
         while( pos1 != String::npos )
         {
            m_location.setCharAt( pos1, '/' );
            pos1 = m_location.find( "\\", pos1 );
         }

         // remove trailing "/"
         if ( m_location.size() > 1 && m_location.getCharAt( m_location.length() - 1 ) == '/' )
            m_location.remove( m_location.length() - 1, 1 );

         compose();
      }

   }
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:37,代码来源:path.cpp


示例13: l_setLocation

static int l_setLocation(lua_State *L) {

   Player     *player;
   Room       *newLocation;
   const char *playerName;
   const char *roomName;

   int n = lua_gettop(L);

   /* script must provide player name and room name as arguments */
   if (n < 2) {
      lua_pushboolean(L, 0);
      lua_pushstring(L, "must pass player and room names to setLocation");
      return 2;
   }

   playerName = lua_tostring(L, 1);
   roomName = lua_tostring(L, 2);

   player = g_hash_table_lookup(g_players, playerName);
   if (NULL == player) {
      lua_pushboolean(L, 0);
      lua_pushstring(L, "player doesn't exist");
      return 2;
   }

   newLocation = g_hash_table_lookup(g_rooms, roomName);
   if (NULL == newLocation) {
      lua_pushboolean(L, 0);
      lua_pushstring(L, "room doesn't exist");
      return 2;
   }

   setLocation(player, newLocation, 0);
   lua_pushboolean(L, 1);
   return 1;
}
开发者ID:jazmyn,项目名称:trogdor,代码行数:37,代码来源:luaapi.c


示例14: hasMoves

/*Determine whether Color has legal Moves on Board*/
int hasMoves(Game *game, Color col){
	ListNode *temp = (ListNode*)malloc(sizeof(ListNode));
	if (temp == NULL) exitOnError("malloc");
	int flag = 0;
	temp->move = NULL;
	temp->next = NULL;
	ListNode *head = temp;
	int i, j;
	for (i = 0; i < BOARD_SIZE; i++){
		for (j = 0; j < BOARD_SIZE; j++){
			if (sameCol(game->board[i][j], col)){
				Location *loc = setLocation(i, j);
				flag = getMovesSinglePiece(game, loc, temp);
				free(loc);
			}
			if (flag){
				freeList(head);
				return 1;
			}
		}
	}
	freeList(head);
	return 0;
}
开发者ID:orrshilon,项目名称:chessprog,代码行数:25,代码来源:Logic.c


示例15: initBricks

/**
 * Initializes window with a grid of bricks.
 */
void initBricks(GWindow window)
{
    int brickLocationX = 2;
    int brickLocationY = 50;
    char* colors[5] = {"RED", "ORANGE", "YELLOW", "GREEN", "CYAN"};
    for (int i = 0; i < ROWS; i++)
    {
        for (int j = 0; j < COLS; j++)
        {
            GRect brick = newGRect(0, 0, BWIDTH, BHEIGHT);
            setFilled(brick, true);
            setColor(brick, colors[i]);
            setLocation(brick, brickLocationX, brickLocationY);
            brickLocationX += 40;
            add(window, brick);
            
            if (j == 9)
            {
                brickLocationX = 2;       
                brickLocationY += 14; 
            }
        }
    }
}
开发者ID:michaelrpease,项目名称:pset3,代码行数:27,代码来源:breakout.c


示例16: setLocation

void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, const LayoutPoint& paintOffset, const LayoutRect& rect)
{
    // Make sure our dimensions match the rect.
    setLocation(rect.location() - toLayoutSize(paintOffset));
    setWidth(rect.width());
    setHeight(rect.height());

    if (graphicsContext->paintingDisabled() || !style().opacity())
        return;

    // We don't use RenderLayers for scrollbar parts, so we need to handle opacity here.
    // Opacity for ScrollbarBGPart is handled by RenderScrollbarTheme::willPaintScrollbar().
    bool needsTransparencyLayer = m_part != ScrollbarBGPart && style().opacity() < 1;
    if (needsTransparencyLayer) {
        graphicsContext->save();
        graphicsContext->clip(rect);
        graphicsContext->beginTransparencyLayer(style().opacity());
    }
    
    // Now do the paint.
    PaintInfo paintInfo(graphicsContext, snappedIntRect(rect), PaintPhaseBlockBackground, PaintBehaviorNormal);
    paint(paintInfo, paintOffset);
    paintInfo.phase = PaintPhaseChildBlockBackgrounds;
    paint(paintInfo, paintOffset);
    paintInfo.phase = PaintPhaseFloat;
    paint(paintInfo, paintOffset);
    paintInfo.phase = PaintPhaseForeground;
    paint(paintInfo, paintOffset);
    paintInfo.phase = PaintPhaseOutline;
    paint(paintInfo, paintOffset);

    if (needsTransparencyLayer) {
        graphicsContext->endTransparencyLayer();
        graphicsContext->restore();
    }
}
开发者ID:nickooms,项目名称:webkit,代码行数:36,代码来源:RenderScrollbarPart.cpp


示例17: setType

GameStart::GameStart() {
  setType("GameStart");

  // Link to "message" sprite.
  df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
  df::Sprite *p_temp_sprite = resource_manager.getSprite("gamestart");
  if (!p_temp_sprite) {
    df::LogManager &log_manager = df::LogManager::getInstance();
    log_manager.writeLog("GameStart::GameStart(): Warning! Sprite 'gamestart' not found");
  } else {
    setSprite(p_temp_sprite);
    setSpriteSlowdown(15);		  
  }

  // Put in center of screen.
  setLocation(df::CENTER_CENTER);

  // Register for "keyboard" event.
  registerInterest(df::KEYBOARD_EVENT);

  // Play start music.
  p_music = df::ResourceManager::getInstance().getMusic("start music");
  playMusic();
}
开发者ID:mark-claypool,项目名称:saucer-shoot-dragonfly,代码行数:24,代码来源:GameStart.cpp


示例18: main

int main(void)
{
    // seed pseudorandom number generator
    srand48(time(NULL));

    // instantiate window
    GWindow window = newGWindow(WIDTH, HEIGHT);

    // instantiate bricks
    initBricks(window);

    // instantiate ball, centered in middle of window
    GOval ball = initBall(window);

    // instantiate paddle, centered at bottom of window
    GRect paddle = initPaddle(window);

    // instantiate scoreboard, centered in middle of window, just above ball
    GLabel label = initScoreboard(window);

    // number of bricks initially
    int bricks = COLS * ROWS;

    // number of lives initially
    int lives = LIVES;

    // number of points initially
    int points = 0;
    
    // need to get velocity of paddle
    double t_paddle = 0.0;
    

    // keep playing until game over
    while (lives > 0 && bricks > 0)
    {
      // Win condition
      if (points == bricks) {
        setLabel(scoreboard, "You WIN!");
        break;
      }
      
      // Lose life condition
      if (getHeight(ball) == HEIGHT) {
        lives--;
        break;
      }
      
      // Dictate Paddle movement
      // Test to see if you can move off screen
      // if left and right cursors move at an accelrated pace, time based
      GKeyEvent e = waitForEvent(KEY_EVENT);
      
      
      
      if (getEventType(e) == LEFT_ARROW_KEY) {
          //KEY_PRESSED
         // KEY_RELEASED
        t_paddle = e.getEventTime();
        move(paddle, -1, 0); 
      }
      else if (getEventType(e) == LEFT_ARROW_KEY) {
        t_paddle = e.getEventTime();
        move(paddle, 1, 0); 
      }
      printf("time of event: %d", t_paddle);
        
      // If ball hits brick
      // Test if top or side of ball hits a brick, does it still detect
      GObject hitBrick = detectCollision(window, ball);
      if(hitBrick != NULL) {
        remove(window, hitBrick);
        points++;
        updateScoreboard(window, scoreboard, points);
        //call ball bounce logic;
      }

      // Ball bouncing logic
      int ballX = getX(ball);
      int ballY = getY(ball);
      int paddleX = getX(paddle);
      
      
      if (ballX == 0 || ballX + getWidth(ball) == WIDTH) {
        setLocation(ball, -ballX, y);
      }
      else if (ballY == 0) {
        setLocation(ball, x, -ballY); 
      }
      
      // Hit paddle and within the width of paddle, do complicated bouncing
      else if (ballY + getHieght(ball) == getY(paddle) &&
        ballX >= paddleX &&
        ballX + getWidth(ball) <= paddleX + getWidth(paddle)) {
        //bounce logic
      }
    }

    // wait for click before exiting
    waitForClick();
//.........这里部分代码省略.........
开发者ID:emtom22,项目名称:CS50-pset3,代码行数:101,代码来源:breakout.c


示例19: m_offset

View::View(QWindow *)
    : PlasmaQuick::Dialog(),
      m_offset(.5),
      m_floating(false)
{
    setClearBeforeRendering(true);
    setColor(QColor(Qt::transparent));
    setFlags(Qt::FramelessWindowHint);

    KCrash::setFlags(KCrash::AutoRestart);

    m_config = KConfigGroup(KSharedConfig::openConfig(QStringLiteral("krunnerrc")), "General");

    setFreeFloating(m_config.readEntry("FreeFloating", false));
    reloadConfig();

    new AppAdaptor(this);
    QDBusConnection::sessionBus().registerObject(QStringLiteral("/App"), this);

    if (KAuthorized::authorize(QStringLiteral("run_command"))) {
        QAction *a = new QAction(0);
        QObject::connect(a, &QAction::triggered, this, &View::displayOrHide);
        a->setText(i18n("Run Command"));
        a->setObjectName(QStringLiteral("run command"));
        KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT + Qt::Key_Space), KGlobalAccel::NoAutoloading);
        KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT + Qt::Key_Space) << QKeySequence(Qt::ALT + Qt::Key_F2) << Qt::Key_Search);

        a = new QAction(0);
        QObject::connect(a, &QAction::triggered, this, &View::displayWithClipboardContents);
        a->setText(i18n("Run Command on clipboard contents"));
        a->setObjectName(QStringLiteral("run command on clipboard contents"));
        KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT+Qt::SHIFT+Qt::Key_F2));
        KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT+Qt::SHIFT+Qt::Key_F2));
    }

    m_qmlObj = new KDeclarative::QmlObject(this);
    m_qmlObj->setInitializationDelayed(true);
    connect(m_qmlObj, &KDeclarative::QmlObject::finished, this, &View::objectIncubated);

    KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"));
    KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE");
    const QString packageName = cg.readEntry("LookAndFeelPackage", QString());
    if (!packageName.isEmpty()) {
        package.setPath(packageName);
    }

    m_qmlObj->setSource(QUrl::fromLocalFile(package.filePath("runcommandmainscript")));
    m_qmlObj->engine()->rootContext()->setContextProperty(QStringLiteral("runnerWindow"), this);
    m_qmlObj->completeInitialization();

    auto screenRemoved = [=](QScreen* screen) {
        if (screen == this->screen()) {
            setScreen(qGuiApp->primaryScreen());
            hide();
        }
    };

    auto screenAdded = [=](QScreen* screen) {
        connect(screen, &QScreen::geometryChanged, this, &View::screenGeometryChanged);
        screenGeometryChanged();
    };

    foreach(QScreen* s, QGuiApplication::screens())
        screenAdded(s);
    connect(qApp, &QGuiApplication::screenAdded, this, screenAdded);
    connect(qApp, &QGuiApplication::screenRemoved, this, screenRemoved);

    connect(KWindowSystem::self(), &KWindowSystem::workAreaChanged, this, &View::resetScreenPos);

    connect(this, &View::visibleChanged, this, &View::resetScreenPos);

    KDirWatch::self()->addFile(m_config.name());

    // Catch both, direct changes to the config file ...
    connect(KDirWatch::self(), &KDirWatch::dirty, this, &View::reloadConfig);
    connect(KDirWatch::self(), &KDirWatch::created, this, &View::reloadConfig);

    if (m_qmlObj->rootObject()) {
        connect(m_qmlObj->rootObject(), SIGNAL(widthChanged()), this, SLOT(resetScreenPos()));
    }

    if (m_floating) {
        setLocation(Plasma::Types::Floating);
    } else {
        setLocation(Plasma::Types::TopEdge);
    }

    connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &View::slotFocusWindowChanged);
}
开发者ID:cmacq2,项目名称:plasma-workspace,代码行数:89,代码来源:view.cpp


示例20: setUid

void OEvent::fromMap( const QMap<int, QString>& map )
{

	// We just want to set the UID if it is really stored.
	if ( !map[OEvent::FUid].isEmpty() )
		setUid( map[OEvent::FUid].toInt() );

	setCategories( idsFromString( map[OEvent::FCategories] ) );
	setDescription( map[OEvent::FDescription] );
	setLocation( map[OEvent::FLocation] );

	if ( map[OEvent::FType] == "AllDay" )
		setAllDay( true );
	else
		setAllDay( false );

	int alarmTime = -1;
	if( !map[OEvent::FAlarm].isEmpty() )
		alarmTime = map[OEvent::FAlarm].toInt();

	int sound = ( ( map[OEvent::FSound] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
	if ( ( alarmTime != -1 )  ){
		QDateTime dt = startDateTime().addSecs( -1*alarmTime*60 );
		OPimAlarm al( sound ,  dt  );
		notifiers().add( al );
	}
	if ( !map[OEvent::FTimeZone].isEmpty() && ( map[OEvent::FTimeZone] != "None" ) ){
		setTimeZone( map[OEvent::FTimeZone] );
	}

	time_t start = (time_t) map[OEvent::FStart].toLong();
	time_t end   = (time_t) map[OEvent::FEnd].toLong();

	/* AllDay is always in UTC */
	if ( isAllDay() ) {
		OTimeZone utc = OTimeZone::utc();
		setStartDateTime( utc.fromUTCDateTime( start ) );
		setEndDateTime  ( utc.fromUTCDateTime( end   ) );
		setTimeZone( "UTC"); // make sure it is really utc
	}else {
		/* to current date time */
		// qWarning(" Start is %d", start );
		OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() );
		QDateTime date = zone.toDateTime( start );
		qWarning(" Start is %s", date.toString().latin1() );
		setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) );

		date = zone.toDateTime( end );
		setEndDateTime  ( zone.toDateTime( date, OTimeZone::current() ) );
	}

	if ( !map[OEvent::FRecParent].isEmpty() )
		setParent( map[OEvent::FRecParent].toInt() );

	if ( !map[OEvent::FRecChildren].isEmpty() ){
		QStringList list = QStringList::split(' ', map[OEvent::FRecChildren] );
		for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
			addChild( (*it).toInt() );
		}
	}

	// Fill recurrence stuff and put it directly into the ORecur-Object using fromMap..
	if( !map[OEvent::FRType].isEmpty() ){
		QMap<int, QString> recFields;
		recFields.insert( ORecur::RType, map[OEvent::FRType] );
		recFields.insert( ORecur::RWeekdays, map[OEvent::FRWeekdays] );
		recFields.insert( ORecur::RPosition, map[OEvent::FRPosition] );
		recFields.insert( ORecur::RFreq, map[OEvent::FRFreq] );
		recFields.insert( ORecur::RHasEndDate, map[OEvent::FRHasEndDate] );
		recFields.insert( ORecur::EndDate, map[OEvent::FREndDate] );
		recFields.insert( ORecur::Created, map[OEvent::FRCreated] );
		recFields.insert( ORecur::Exceptions, map[OEvent::FRExceptions] );
		ORecur recur( recFields );
		setRecurrence( recur );
	}

}
开发者ID:opieproject,项目名称:opie,代码行数:77,代码来源:oevent.cpp



注:本文中的setLocation函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setLoop函数代码示例发布时间:2022-05-30
下一篇:
C++ setLoading函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap