Exemplo n.º 1
0
Arquivo: ffcp.cpp Projeto: sylzd/FFCP
void FFCP::createActions()
{
	newAct = new QAction( tr("新建"), this);  //QIcon("./images/open.png"), 暂时不设置图片
	newAct->setShortcut(tr("N"));   
	connect(newAct, SIGNAL(triggered()), this, SLOT(newSlot()));

	openAct = new QAction(tr("打开"), this);
	openAct->setShortcut(tr("O"));   
	connect(openAct, SIGNAL(triggered()), this, SLOT(openSlot()));

	saveAct = new QAction(tr("保存"), this);
	saveAct->setShortcut(tr("S"));
	connect(saveAct, SIGNAL(triggered()), this, SLOT(saveSlot()));

	quitAct = new QAction(tr("退出"), this);
	quitAct->setShortcut(tr("Q"));
	connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));

	aboutAct = new QAction(tr("关于"), this);
	aboutAct->setShortcut(tr("A"));
	connect(aboutAct, SIGNAL(triggered()), this, SLOT(aboutSlot()));

	compileAct = new QAction(tr("编译"), this);
	compileAct->setShortcut(tr("F7"));
	connect(compileAct, SIGNAL(triggered()), this, SLOT(compileSlot()));

	simulationAct = new QAction(tr("仿真"), this);
	simulationAct->setShortcut(tr("F6"));
	connect(simulationAct, SIGNAL(triggered()), this, SLOT(simulationSlot()));

	downloadAct = new QAction(tr("下载"), this);
	downloadAct->setShortcut(tr("F5"));
	connect(downloadAct, SIGNAL(triggered()), this, SLOT(downloadSlot()));

	clearAct = new QAction(tr("清除"), this);
	clearAct->setShortcut(tr("F8"));
	connect(clearAct, SIGNAL(triggered()), this, SLOT(clearSlot()));

	//在工具中添加变量定义
	defineAct = new QAction(tr("变量定义"),this);
	defineAct->setShortcut(tr("F1"));
	connect(defineAct, SIGNAL(triggered()), this, SLOT(defineSlot()));

	hardwareAct = new QAction(tr("硬件结构图"), this);
	defineAct->setShortcut(tr("F3"));
	connect(hardwareAct, SIGNAL(triggered()), this, SLOT(hardwareSlot()));

	softwareAct = new QAction(tr("软件流程图"), this);
	defineAct->setShortcut(tr("F2"));
	connect(softwareAct, SIGNAL(triggered()), this, SLOT(softwareSlot()));
}
Exemplo n.º 2
0
void playlist::beginDownload(int position)
{
    this->currentdownloaditem = position;
    qDebug() << "StartDownlaod:" << pList->at(position)->songId;
    QNetworkRequest req;
    req.setUrl(*pList->at(currentdownloaditem)->server);
    qDebug() << pList->at(currentdownloaditem)->server;
    req.setHeader(req.ContentTypeHeader,QVariant("application/x-www-form-urlencoded"));
    if(reply)
    {
        reply->disconnect();
        reply->deleteLater();
    }
    reply = manager->post(req,QString("streamKey=" + pList->at(this->currentdownloaditem)->streamkey->toAscii()).toAscii());
    pList->at(this->currentdownloaditem)->buffer->open(QBuffer::ReadWrite | QBuffer::Truncate);
    connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(downloadSlot(qint64,qint64)));
    connect(reply,SIGNAL(finished()),this,SLOT(networkReplyFinish()));
    connect(this,SIGNAL(downloadComplete(int)),this,SLOT(downloadDone(int)));
    connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(getNError(QNetworkReply::NetworkError)));
    startStreamT = QTime::currentTime();
}
Exemplo n.º 3
0
void playlist::networkReplyFinish()
{
    qDebug() << "finish";
    QVariant url = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
    if(url.toUrl().isValid())
    {
        QNetworkRequest req;
        req.setUrl(url.toUrl());
        qDebug() << url;
        if(reply)
        {
            reply->disconnect();
            reply->deleteLater();
        }
        reply = manager->get(req);
        startStreamT = QTime::currentTime();
        //connect(reply,SIGNAL(finished()),this,SLOT(start()));
        connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(downloadSlot(qint64,qint64)));
        connect(reply,SIGNAL(finished()),this,SLOT(networkReplyFinish()));
        connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(getNError(QNetworkReply::NetworkError)));
    }
}