コード例 #1
0
void StatusBarClock::setPadding( unsigned int padding)
{
	m_textPadding = padding;

	// force re-calculation of the bounding rect
	setDisplayDate(m_displayDate);
}
コード例 #2
0
StatusBarClock::StatusBarClock(unsigned int padding)
	: m_clockTimer(new QTimer(this))
	, m_font(0)
	, m_twelveHour(true)
	, m_displayDate(false)
	, m_curTimeStr(0)
	, m_textPadding(padding)
{
	connect(m_clockTimer, SIGNAL(timeout()), this, SLOT(tick()));
	m_clockTimer->start(1000);

	StatusBarServicesConnector* svcConnector = StatusBarServicesConnector::instance();

	if(svcConnector) {
		connect(svcConnector,SIGNAL(signalSystemTimeChanged()), this, SLOT(slotSystemTimeChanged()));
	}

	// Set up text
	const char* fontName = Settings::LunaSettings()->fontStatusBar.c_str();
	m_font = new QFont(fontName, 15);
	m_font->setPixelSize(15);

	if (m_font) {
		m_font->setBold(true);
	}

	::memset(m_timeBuf, 0, sizeof(m_timeBuf));
	::memset(&m_lastUpdateTime, 0, sizeof(m_lastUpdateTime));
	
    setDisplayDate(false); // this will set the correct bounding rect and update the time

    if(Settings::LunaSettings()->demoMode)
    	setTimeText(QString(DEMO_MODE_TIME));
}
コード例 #3
0
void Element::recountDisplayDateInBlocks() {
	setDisplayDate([&] {
		const auto item = data();
		if (item->isEmpty()) {
			return false;
		}

		if (const auto previous = previousInBlocks()) {
			const auto prev = previous->data();
			return prev->isEmpty()
				|| (previous->dateTime().date() != dateTime().date());
		}
		return true;
	}());
}