本文整理汇总了C++中Downloader::getState方法的典型用法代码示例。如果您正苦于以下问题:C++ Downloader::getState方法的具体用法?C++ Downloader::getState怎么用?C++ Downloader::getState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Downloader
的用法示例。
在下文中一共展示了Downloader::getState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setActionsEnabled
void MainWindow::setActionsEnabled()
{
// Find the view item and downloader for the current row, and update
// the states of the actions.
QTreeWidgetItem *item = 0;
if (!jobView->selectedItems().isEmpty())
{
item = jobView->selectedItems().first();
}
Downloader *downloader = item ? jobs.at(jobView->indexOfTopLevelItem(item)).downloader : 0;
bool pauseEnabled = downloader && (downloader->getState() == Status::Downloading || downloader->getState() == Status::Paused /* for resume */);
bool openDirEnabled = downloader && downloader->getState() != Status::Idle;
openDirAction->setEnabled(item != 0 && openDirEnabled);
pauseJobAction->setEnabled(item != 0 && pauseEnabled);
if (downloader && downloader->getState() != Status::Pausing && downloader->getState() != Status::Starting)
{
removeJobAction->setEnabled(item != 0);
}
else
{
removeJobAction->setEnabled(false);
}
if (downloader && downloader->getState() == Status::Paused)
{
pauseJobAction->setIcon(QIcon(":/ui/icons/player_play.png"));
pauseJobAction->setText(tr("Resume job"));
}
else
{
pauseJobAction->setIcon(QIcon(":/ui/icons/player_pause.png"));
pauseJobAction->setText(tr("Pause job"));
}
}