当前位置: 首页>>代码示例>>C++>>正文


C++ TaskItem::updateInfo方法代码示例

本文整理汇总了C++中TaskItem::updateInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskItem::updateInfo方法的具体用法?C++ TaskItem::updateInfo怎么用?C++ TaskItem::updateInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TaskItem的用法示例。


在下文中一共展示了TaskItem::updateInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: catch

/**
 * \brief Really do the update
 *
 * When the timer's action slot finds out that some task ids have changed,
 * this slot is called to actually perform the udpate
 */
void	TaskMainWindow::taskRealUpdate(int taskid) {
	debug(LOG_DEBUG, DEBUG_LOG, 0, "real task update %d", taskid);

	// retrieve the task information from the 
	Astro::TaskInfo_var	info;
	try {
		info = taskqueue->info(taskid);
	} catch (Astro::NotFound x) {
		debug(LOG_DEBUG, DEBUG_LOG, 0, "%d not found, removing it",
			taskid);
		remove(taskid);
		return;
	} catch (const std::exception& x) {
		debug(LOG_DEBUG, DEBUG_LOG, 0, "cannot get task info: %s",
			x.what());
		return;
	} catch (const CORBA::SystemException& x) {
		debug(LOG_DEBUG, DEBUG_LOG, 0, "corba system exception");
		return;
	} catch (const CORBA::UserException& x) {
		debug(LOG_DEBUG, DEBUG_LOG, 0, "corba user exception");
		return;
	} catch (const CORBA::Exception& x) {
		debug(LOG_DEBUG, DEBUG_LOG, 0, "corba exception");
		return;
	} catch (...) {
		debug(LOG_ERR, DEBUG_LOG, 0, "unknown error");
		throw;
		return;
	}
	time_t	now = time(NULL);
	info->lastchange = now - info->lastchange;
	debug(LOG_DEBUG, DEBUG_LOG, 0, "got updated info for task %d", taskid);

	// depending on whether the task already exists in the list,
	// we will add or udpate the stuff
	int	index = indexForTask(taskid);
	if (index < 0) {
		debug(LOG_DEBUG, DEBUG_LOG, 0, "must insert entry");

		// to insert an entry, we also need the parameters
		Astro::TaskParameters_var	params
			= taskqueue->parameters(taskid);
		debug(LOG_DEBUG, DEBUG_LOG, 0,
			"task parameters for %d retrieved", taskid);

		// create a list item
		QListWidgetItem	*lwi = new QListWidgetItem();
		lwi->setSizeHint(QSize(300,90));
		TaskItem	*ti = new TaskItem(info, params);
		ui->tasklistWidget->addItem(lwi);
		ui->tasklistWidget->setItemWidget(lwi, ti);

		// make sure the list is repainted
		repaint();

		// insert case done
		debug(LOG_DEBUG, DEBUG_LOG, 0, "entry for task %d inserted",
			taskid);
		return;
	}

	// retrieve the task TaskItem from the list, 
	debug(LOG_DEBUG, DEBUG_LOG, 0, "we have to update task %d", taskid);
	QListWidgetItem	*lwi = ui->tasklistWidget->item(index);
	TaskItem	*ti = (TaskItem *)ui->tasklistWidget->itemWidget(lwi);
	debug(LOG_DEBUG, DEBUG_LOG, 0, "update entry %d", index);
	ti->updateInfo(info);

	// we have to repaint the item, because otherwise it will only repaint
	// when the it becomes visible after a list move, or when the window
	// receives a repaint event.
	ti->repaint();
}
开发者ID:felipebetancur,项目名称:AstroPhotography-2,代码行数:80,代码来源:taskmainwindow.cpp


注:本文中的TaskItem::updateInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。