Пример #1
0
bool ChannelFeed::navigate(const std::string& channelId, const std::string& msgId)
{
	if (channelId.empty()) {
		return false;
	}

	if (treeWidget->activateId(QString::fromStdString(channelId), msgId.empty()) == NULL) {
		return false;
	}

	/* Messages are filled in selectChannel */
	if (mChannelId != channelId) {
		return false;
	}

	if (msgId.empty()) {
		return true;
	}

	/* Search exisiting item */
	QList<ChanMsgItem*>::iterator mit;
	for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) {
		ChanMsgItem *item = *mit;
		if (item->msgId() == msgId) {
			// the next two lines are necessary to calculate the layout of the widgets in the scroll area (maybe there is a better solution)
			item->show();
			QCoreApplication::processEvents();

			scrollArea->ensureWidgetVisible(item, 0, 0);
			return true;
		}
	}

	return false;
}
Пример #2
0
void GxsChannelDialog::fillThreadAddMsg(const QString &channelId, const QString &channelMsgId, int current, int count)
{
	if (sender() == fillThread) {
		// show fill progress
		if (count) {
			progressBar->setValue(current * progressBar->maximum() / count);
		}

		lockLayout(NULL, true);

		ChanMsgItem *cmi = new ChanMsgItem(this, 0, channelId.toStdString(), channelMsgId.toStdString(), true);
		mChanMsgItems.push_back(cmi);
		verticalLayout->addWidget(cmi);
		cmi->show();

		lockLayout(cmi, false);
	}
}