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


C++ Transfer::getState方法代码示例

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


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

示例1: stopResumeTransfer

void TransfersContentsWidget::stopResumeTransfer()
{
	Transfer *transfer = getTransfer(m_ui->transfersViewWidget->selectionModel()->hasSelection() ? m_ui->transfersViewWidget->selectionModel()->currentIndex() : QModelIndex());

	if (transfer)
	{
		if (transfer->getState() == Transfer::RunningState)
		{
			transfer->stop();
		}
		else if (transfer->getState() == Transfer::ErrorState)
		{
			transfer->resume();
		}

		updateActions();
	}
}
开发者ID:lpxxn,项目名称:otter-browser,代码行数:18,代码来源:TransfersContentsWidget.cpp

示例2: transferStarted

void TransfersManager::transferStarted()
{
	Transfer *transfer = qobject_cast<Transfer*>(sender());

	if (transfer && transfer->getState() != Transfer::CancelledState)
	{
		emit transferStarted(transfer);

		scheduleSave();
	}
}
开发者ID:kyleivey,项目名称:otter-browser,代码行数:11,代码来源:TransfersManager.cpp

示例3: transferFinished

void Updater::transferFinished()
{
	Transfer *transfer = qobject_cast<Transfer*>(sender());

	if (transfer)
	{
		const QString path = transfer->getTarget();

		if ((transfer->getState() == Transfer::FinishedState) && QFile::exists(path))
		{
			if (QFileInfo(path).suffix() == QLatin1String("xml"))
			{
				QFile file(SessionsManager::getWritableDataPath(QLatin1String("update.txt")));

				if (file.open(QIODevice::ReadWrite | QIODevice::Text))
				{
					QTextStream stream(&file);
					stream << path;

					file.close();
				}
			}
		}
		else
		{
			Console::addMessage(QCoreApplication::translate("main", "Unable to download update: %1\nError: %2").arg(transfer->getSource().url()).arg(transfer->getState()), OtherMessageCategory, ErrorMessageLevel);

			m_transfersSuccessful = false;
		}

		transfer->deleteLater();
	}
	else
	{
		m_transfersSuccessful = false;
	}

	++m_transfersCount;

	if (m_transfersCount == 2)
	{
		if (!m_transfersSuccessful)
		{
			clearUpdate();
		}

		emit finished(m_transfersSuccessful);

		deleteLater();
	}
}
开发者ID:aurhat,项目名称:otter-browser,代码行数:51,代码来源:Updater.cpp

示例4: startTransfer

Transfer* TransfersManager::startTransfer(QNetworkReply *reply, const QString &target, Transfer::TransferOptions options)
{
	Transfer *transfer = new Transfer(reply, target, options, m_instance);

	if (transfer->getState() == Transfer::CancelledState)
	{
		transfer->deleteLater();

		return NULL;
	}

	addTransfer(transfer);

	return transfer;
}
开发者ID:kyleivey,项目名称:otter-browser,代码行数:15,代码来源:TransfersManager.cpp

示例5: removeTransfer

void TransfersContentsWidget::removeTransfer()
{
	Transfer *transfer = getTransfer(m_ui->transfersViewWidget->currentIndex());

	if (transfer)
	{
		if (transfer->getState() == Transfer::RunningState && QMessageBox::warning(this, tr("Warning"), tr("This transfer is still running.\nDo you really want to remove it?"), (QMessageBox::Yes | QMessageBox::Cancel)) == QMessageBox::Cancel)
		{
			return;
		}

		m_speeds.remove(transfer);

		m_model->removeRow(m_ui->transfersViewWidget->currentIndex().row());

		TransfersManager::removeTransfer(transfer);
	}
}
开发者ID:lpxxn,项目名称:otter-browser,代码行数:18,代码来源:TransfersContentsWidget.cpp

示例6: transferFinished

void TransfersManager::transferFinished()
{
	Transfer *transfer = qobject_cast<Transfer*>(sender());

	if (transfer)
	{
		if (transfer->getState() == Transfer::FinishedState)
		{
			connect(NotificationsManager::createNotification(NotificationsManager::TransferCompletedEvent, tr("Transfer completed:\n%1").arg(QFileInfo(transfer->getTarget()).fileName()), Notification::InformationLevel, this), SIGNAL(clicked()), transfer, SLOT(openTarget()));
		}

		emit transferFinished(transfer);

		if (!m_privateTransfers.contains(transfer))
		{
			scheduleSave();
		}
	}
}
开发者ID:kyleivey,项目名称:otter-browser,代码行数:19,代码来源:TransfersManager.cpp

示例7: showContextMenu

void TransfersContentsWidget::showContextMenu(const QPoint &point)
{
	Transfer *transfer = getTransfer(m_ui->transfersViewWidget->indexAt(point));
	QMenu menu(this);

	if (transfer)
	{
		menu.addAction(tr("Open"), this, SLOT(openTransfer()));

		const QList<ApplicationInformation> applications = Utils::getApplicationsForMimeType(transfer->getMimeType());

		if (applications.count() > 1)
		{
			QMenu *applicationsMenu = menu.addMenu(tr("Open With"));

			for (int i = 0; i < applications.count(); ++i)
			{
				applicationsMenu->addAction(applications.at(i).icon, ((applications.at(i).name.isEmpty()) ? tr("Unknown") : applications.at(i).name))->setData(applications.at(i).command);

				if (i == 0)
				{
					applicationsMenu->addSeparator();
				}
			}

			connect(applicationsMenu, SIGNAL(triggered(QAction*)), this, SLOT(openTransfer(QAction*)));
		}

		menu.addAction(tr("Open Folder"), this, SLOT(openTransferFolder()));
		menu.addSeparator();
		menu.addAction(((transfer->getState() == Transfer::ErrorState) ? tr("Resume") : tr("Stop")), this, SLOT(stopResumeTransfer()))->setEnabled(transfer->getState() == Transfer::RunningState || transfer->getState() == Transfer::ErrorState);
		menu.addAction(tr("Redownload"), this, SLOT(redownloadTransfer()));
		menu.addSeparator();
		menu.addAction(tr("Copy Transfer Information"), this, SLOT(copyTransferInformation()));
		menu.addSeparator();
		menu.addAction(tr("Remove"), this, SLOT(removeTransfer()));
	}
开发者ID:lpxxn,项目名称:otter-browser,代码行数:37,代码来源:TransfersContentsWidget.cpp


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