/*
    2ndary construction, called from public's constructor.
*/
void HbIndexFeedbackPrivate::init()
{
    Q_Q( HbIndexFeedback );

    //mItemView = 0; // double check that this is safe.

    HbEffect::add(HB_INDEXFEEDBACK_TYPE, "indexfeedback_appear", EFFECT_IFAPPEAR);
    if (!HbEffect::add(HB_INDEXFEEDBACK_TYPE, "indexfeedback_disappear", EFFECT_IFDISAPPEAR)) {
        mDisappearTimer = new QTimer(q);
        mDisappearTimer->setSingleShot(true);
        mDisappearTimer->setInterval(INDEX_FEEDBACK_DISAPPEAR_DURATION);
        q->connect(mDisappearTimer, SIGNAL(timeout()),
            q, SLOT(_q_hideIndexFeedbackNow()));
    }

    mIndexFeedbackTimer = new QTimer(q);
    mIndexFeedbackTimer->setSingleShot(true);
    q->connect(mIndexFeedbackTimer, SIGNAL(timeout()),
        q, SLOT(_q_hideIndexFeedback()));

    createPrimitives();

    // ensure that the index feedback is shown on top of the itemView in
    // all cases. 
    q->setZValue(1);
}
/*!
    @copydoc HbWidget::updatePrimitives()
 */
void SnsrOledClockWidget::updatePrimitives()
{
    if (!mClockHourHand || !mClockMinuteHand || !mClockAmPmLabel) {
        createPrimitives();
    }
    Q_ASSERT( mClockHourHand && mClockMinuteHand && mClockAmPmLabel );
    
    // Calculate angles for clock hands.
    // Use granularity of one minute so that minute hand is always exactly
    // on some minute and not between minutes. OLED clock is not updated more
    // frequently than once per minute and using finer granularity would cause
    // the minute hand to be always between even minutes.
    QTime time = QTime::currentTime();
    qreal m = 6 * time.minute();
    qreal h = 30 * ((time.hour() % 12) + m/360);
    
    int x = mClockHourHand->preferredSize().width()/2;
    int y = mClockHourHand->preferredSize().height()/2;
    mClockHourHand->setTransform(QTransform().translate(x, y).rotate(h).translate(-x, -y));

    x = mClockMinuteHand->preferredSize().width()/2;
    y = mClockMinuteHand->preferredSize().height()/2;
    mClockMinuteHand->setTransform(QTransform().translate(x, y).rotate(m).translate(-x, -y));

    QString amPmString = (time.hour()<12) ? HbExtendedLocale().amText() : HbExtendedLocale().pmText();
    mClockAmPmLabel->setText( amPmString );
}
Esempio n. 3
0
int main(int argc, char **argv)
{
  testInit(argc, argv, 500,500, "ShivaVG: VGU Primitives Test");
  testCallback(TEST_CALLBACK_DISPLAY, (CallbackFunc)display);
  
  createPrimitives();
  testRun();
  
  return EXIT_SUCCESS;
}
/*!
    Constructs a new SnsrOledClockWidget.
    \param parent Parent object.
 */
SnsrOledClockWidget::SnsrOledClockWidget(QGraphicsItem* parent):
    HbWidget(parent),
    mClockBackground(0), mClockHourHand(0), mClockMinuteHand(0),
    mClockAmPmLabel(0)
{
    HbStyleLoader::registerFilePath(gOledClockCssFilePath);
    HbStyleLoader::registerFilePath(gOledClockWidgetMLFilePath);

    createPrimitives();
    updatePrimitives();
}
BubbleHeadingWidget::BubbleHeadingWidget(QGraphicsItem* item)
    : HbWidget(item), mLineCount(0), mIndicator1(0),
      mIndicator2(0), mText1(0), mText2(0), mText3(0)
{
    createPrimitives();

    HbStyleLoader::registerFilePath(
        QLatin1String(":/bubbleheadingwidget.css"));
    HbStyleLoader::registerFilePath(
        QLatin1String(":/bubbleheadingwidget.widgetml"));

    // font is update in code, because cli position is changing
    mCliFont = new HbFontSpec(HbFontSpec::Primary);
    mTextFont = new HbFontSpec(HbFontSpec::Secondary);

    mCliFont->setTextHeight(4*HbDeviceProfile::current().unitValue());
    mTextFont->setTextHeight(4*HbDeviceProfile::current().unitValue());
}
Esempio n. 6
0
void Model_Sonic::createGeometry(ParserContext &ctx) {
	_geometries.resize(ctx.polygons.size());
	for (size_t i = 0; i < ctx.polygons.size(); i++) {
		Polygon  &polygon  = ctx.polygons[i];
		Geometry &geometry = _geometries[i];

		// Load texture
		try {
			if (polygon.material && !polygon.material->texture.empty())
				geometry.texture = TextureMan.get(polygon.material->texture);
		} catch (Common::Exception &e) {
			Common::printException(e, "WARNING: ");
		}

		// Create the primitives and their vertices
		createPrimitives(ctx, geometry, polygon);

		// And fill in the indices
		for (Primitives::iterator p = geometry.primitives.begin(); p != geometry.primitives.end(); ++p)
			createIndices(*p);
	}
}
Esempio n. 7
0
void HbComboBoxPrivate::init( )
{
    createPrimitives( );
}