int DateClass::setMin(int min){ if(validRange(min,60)){ this->min = min; return dateOk; }else{ return badMin; } }
int DateClass::setSec(int sec){ if(validRange(sec,60)){ this->sec = sec; return dateOk; }else{ return badSec; } }
int DateClass::setMon(Months mon){ if(validRange(static_cast<int>(mon),12)){ this->mon = mon; return dateOk; }else{ return badMon; } }
int DateClass::setHour(int hour){ if(validRange(sec,24)){ this->hour = hour; return dateOk; }else{ return badHour; } }
int DateClass::setMday(int day){ if ((this->year != -1)&&(this->mon != -1)){ if(validRange(sec,getNumberOfDaysInMonth(this->mon))){ this->mday = day; return dateOk; }else{ return badDay; } }else{ return badDay; } }
void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &) { // Note: based on x11 implementation static const int XCOORD_MAX = 16383; static const int WRECT_MAX = 16383; Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); /* There are up to four different coordinate systems here: Qt coordinate system for this widget. Symbian coordinate system for this widget (relative to wrect). Qt coordinate system for parent Symbian coordinate system for parent (relative to parent's wrect). */ QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX); QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX); QRect wrect; //xrect is the Symbian geometry of my widget. (starts out in parent's Qt coord sys, and ends up in parent's Symbian coord sys) QRect xrect = data.crect; const QWidget *const parent = q->parentWidget(); QRect parentWRect = parent->data->wrect; if (parentWRect.isValid()) { // parent is clipped, and we have to clip to the same limit as parent if (!parentWRect.contains(xrect)) { xrect &= parentWRect; wrect = xrect; //translate from parent's to my Qt coord sys wrect.translate(-data.crect.topLeft()); } //translate from parent's Qt coords to parent's X coords xrect.translate(-parentWRect.topLeft()); } else { // parent is not clipped, we may or may not have to clip if (data.wrect.isValid() && QRect(QPoint(),data.crect.size()).contains(data.wrect)) { // This is where the main optimization is: we are already // clipped, and if our clip is still valid, we can just // move our window, and do not need to move or clip // children QRect vrect = xrect & parent->rect(); vrect.translate(-data.crect.topLeft()); //the part of me that's visible through parent, in my Qt coords if (data.wrect.contains(vrect)) { xrect = data.wrect; xrect.translate(data.crect.topLeft()); if (data.winid) data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height())); return; } } if (!validRange.contains(xrect)) { // we are too big, and must clip xrect &=wrectRange; wrect = xrect; wrect.translate(-data.crect.topLeft()); //parent's X coord system is equal to parent's Qt coord //sys, so we don't need to map xrect. } } // unmap if we are outside the valid window system coord system bool outsideRange = !xrect.isValid(); bool mapWindow = false; if (q->testAttribute(Qt::WA_OutsideWSRange) != outsideRange) { q->setAttribute(Qt::WA_OutsideWSRange, outsideRange); if (outsideRange) { if (data.winid) data.winid->DrawableWindow()->SetVisible(EFalse); q->setAttribute(Qt::WA_Mapped, false); } else if (!q->isHidden()) { mapWindow = true; } } if (outsideRange) return; bool jump = (data.wrect != wrect); data.wrect = wrect; // and now recursively for all children... for (int i = 0; i < children.size(); ++i) { QObject *object = children.at(i); if (object->isWidgetType()) { QWidget *w = static_cast<QWidget *>(object); if (!w->isWindow() && w->testAttribute(Qt::WA_WState_Created)) w->d_func()->setWSGeometry(jump); } } if (data.winid) { // move ourselves to the new position and map (if necessary) after // the movement. Rationale: moving unmapped windows is much faster // than moving mapped windows if (!parent->internalWinId()) xrect.translate(parent->mapTo(q->nativeParentWidget(), QPoint(0, 0))); data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height())); } if (mapWindow and !dontShow) { q->setAttribute(Qt::WA_Mapped); if (q->internalWinId()) q->internalWinId()->DrawableWindow()->SetVisible(ETrue); } if (jump && data.winid) { RWindow *const window = static_cast<RWindow *>(data.winid->DrawableWindow()); window->Invalidate(TRect(0, 0, wrect.width(), wrect.height())); } }