static int headType(int tickLen, TDuration* type) { if (tickLen == 0) { *type = TDuration(TDuration::V_MEASURE); return 0; } TDuration dt; for (int i = 0; i < TDuration::V_ZERO; ++i) { dt.setType(TDuration::DurationType(i)); int ticks = dt.ticks(); if (tickLen / ticks) { int remain = tickLen % ticks; if ((ticks - remain) < (ticks/4)) { *type = TDuration(TDuration::DurationType(i-1)); return 0; } *type = dt; int dots; int rest = getDots(ticks, remain, &dots); dt.setDots(dots); return rest; } } qDebug("1: no duration type for ticks %d", tickLen); *type = TDuration(TDuration::V_QUARTER); return 0; }
void SplashScreenWidget::timerEvent(QTimerEvent *e){ getTask(); if(e->timerId()==dots_timer_id){ getDots(); } drawInfo(); update(); QObject::timerEvent(e); }
SplashScreenWidget::SplashScreenWidget(){ setObjectName("splash_screen_widget"); Version v = Version::appVersion(); version = v.text; QImage image(":ugene/images/ugene_splash.png"); QSize widgetSize = image.size(); setFixedSize(widgetSize); image = image.scaled(widgetSize * devicePixelRatio()); image.setDevicePixelRatio(devicePixelRatio()); image1 = image2 = image; dots_number = 0; task = ""; dots_timer_id = startTimer(500); startTimer(50); getTask(); getDots(); drawInfo(); }
void TDuration::setVal(int ticks) { if (ticks == 0) _val = V_MEASURE; else { TDuration dt; for (int i = 0; i < TDuration::V_ZERO; ++i) { dt.setType(TDuration::DurationType(i)); int t = dt.ticks(); if (ticks / t) { int remain = ticks % t; if ((t - remain) < (t/4)) { _val = DurationType(i - 1); return; } _val = DurationType(i); getDots(t, remain, &_dots); return; } } qDebug("2: no duration type for ticks %d", ticks); _val = V_QUARTER; // fallback default value } }