예제 #1
0
	void FileSharingWidget::connectFileDownloadSignals(const bool isConnected)
	{
		connectCoreSignal(
			SIGNAL(fileSharingFileDownloaded(qint64, QString, QString)),
			SLOT(fileDownloaded(qint64, QString, QString)),
			isConnected);

		connectCoreSignal(
			SIGNAL(fileSharingFileDownloading(qint64, QString, qint64)),
			SLOT(fileDownloading(qint64, QString, qint64)),
			isConnected);

		connectCoreSignal(
			SIGNAL(fileSharingDownloadError(qint64, QString, qint32)),
			SLOT(fileDownloadError(qint64, QString, qint32)),
			isConnected);

		connectCoreSignal(
			SIGNAL(fileSharingLocalCopyCheckCompleted(qint64, bool, QString)),
			SLOT(fileLocalCopyChecked(qint64, bool, QString)),
			isConnected);
	}
예제 #2
0
파일: maindlg.cpp 프로젝트: deadbird99/Tinu
MainDlg::MainDlg(QWidget *parent) : QDialog(parent), ui(new Ui::MainDlg) {
    ui->setupUi(this);



    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setWindowOpacity(0.95);
    this->setFixedSize(this->geometry().size());

    //prepare system tray icon
    trayIcon = new QSystemTrayIcon(this);
    trayIcon->setIcon(QIcon(":/rsc/package.png"));
    trayIcon->setVisible(true);
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));

    //prepare nice wait layer
    waitLayer = new QLabel(this);
    waitLayer->setGraphicsEffect(new QGraphicsBlurEffect());
    waitLayer->setPixmap(this->grab());
    waitLayer->hide();

    //connect minimize and close signals
    connect(ui->titleBar, SIGNAL(closeApp()), this, SLOT(closeApp()));
    connect(ui->titleBar, SIGNAL(minimizeApp()), this, SLOT(minimizeApp()));
    connect(ui->titleBar, SIGNAL(aboutApp()), this, SLOT(about()));

    //show waitLayer while working
    showWaitLayer(true);

    //retrieve once-for-all tmpPath
    tmpDir = FileTools::getInstance()->getTmpPath();

    //retrieve and parse list.xml
    dfh = new DownloadFileHandler(listDotZipPath, tmpDir, false);
    qDebug()<<tmpDir;
    connect(dfh, SIGNAL(fileDownloadFinished()), this, SLOT(parseListDotXml()));
    connect(dfh, SIGNAL(fileDownloadError(QString)), this, SLOT(downloadError(QString)));
    dfh->beginDownload();
}
qint64 QGitHubReleaseAPIPrivate::downloadFile(const QUrl &u, QIODevice *of, bool generic) const {

	m_readBytes = Q_INT64_C(-1);

	if(of) {

		QEventLoop wait;
		FileDownloader dl(u, m_userAgent, m_eTag);

		m_dlOutputFile = of;

		dl.setCacheLoadControlAttribute(QNetworkRequest::PreferCache);
		dl.setGeneric(generic);

		QObject::connect(&dl, SIGNAL(canceled()), &wait, SLOT(quit()));
		QObject::connect(&dl, SIGNAL(error(QString)), &wait, SLOT(quit()));
		QObject::connect(&dl, SIGNAL(downloaded(FileDownloader)), &wait, SLOT(quit()));
		QObject::connect(&dl, SIGNAL(replyChanged(QNetworkReply*)),
						 this, SLOT(updateReply(QNetworkReply*)));
		QObject::connect(&dl, SIGNAL(canceled()), this, SLOT(fdCanceled()));
		QObject::connect(&dl, SIGNAL(error(QString)), this, SLOT(fileDownloadError(QString)));
		QObject::connect(&dl, SIGNAL(progress(qint64,qint64)),
						 this, SLOT(fileDownloadProgress(qint64,qint64)));

		m_readReply = dl.start(QGitHubReleaseAPI::RAW);

		QObject::connect(m_readReply, SIGNAL(readyRead()), this, SLOT(readChunk()));
		wait.exec();

		m_dlOutputFile = 0L;
	}

	m_readReply = 0L;

	return m_readBytes;
}
예제 #4
0
ImageProcessing::ImageProcessing(QWidget *parent) : QMainWindow(parent) {
	iImageIndex = 0;
	m_NetTimeout = 0;
	m_ImageTimeout = 0;

	lbImage = new QLabel(this);
    bTurnOff = false;
    m_notRunning = true;
	setWindowState(Qt::WindowFullScreen);

	player = new QMediaPlayer(this);
    playlist = new QMediaPlaylist();
    player->setPlaylist(playlist);

    m_contentList = new FileDownload(this);
    m_imageFile = new FileDownload(this);

	pNextImage = new QTimer();

	connect(pNextImage, SIGNAL(timeout()), this, SLOT(timeout()));
    connect(m_contentList, SIGNAL(downloaded()), this, SLOT(contentListDownloadComplete()));
    connect(m_contentList, SIGNAL(downloadError(QNetworkReply::NetworkError)), this, SLOT(fileDownloadError(QNetworkReply::NetworkError)));
    connect(m_imageFile, SIGNAL(downloaded()), this, SLOT(fileDownloadComplete()));
    connect(m_imageFile, SIGNAL(downloadError(QNetworkReply::NetworkError)), this, SLOT(fileDownloadError(QNetworkReply::NetworkError)));
    connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
    connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
    connect(player, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged()));
    connect(player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(displayErrorMessage()));
    connect(this, SIGNAL(fileDownloadsComplete()), this, SLOT(unlockShowEvent()));

    videoWidget = new QVideoWidget(this);
    player->setVideoOutput(videoWidget);
    videoWidget->hide();
}