// 一开始把图片添加到每个block上,然后排列到mainlayout上面
void BlockAreaCatch::set_block_area() {
    mainLayout = new QVBoxLayout(this);
    hLayout = new QHBoxLayout();
    QLabel *text = new QLabel("剩余时间: ");
    QFont labelFont;
    labelFont.setPointSize(14);
    text->setFont(labelFont);
    bar = new QProgressBar();
    bar->resize(600, 30);
    hLayout->addWidget(text);
    hLayout->addWidget(bar);
    gridLayout = new QGridLayout();
    for(int i = 0; i < myRow; ++i){
        for(int j = 0; j < myColumn; ++j){
            Block *bb = new Block;
            w = bb->width();
            h = bb->height();
            bb->setNumber(i, j);
            originalState(bb);
            bb->setPixmap(QPixmap(":/image/0.png"));
            gridLayout->addWidget(bb, i, j, Qt::AlignCenter);
            connect(bb, SIGNAL(userAction(onePointPosition)), this, SLOT(checkIt(onePointPosition)));
        }
    }
    mainLayout->addLayout(hLayout);
    mainLayout->addLayout(gridLayout);
    bar->setMaximum(counter);
    timer.setInterval(100);
    connect(&timer, SIGNAL(timeout()), this, SLOT(updateProgressbar()));
    timer.start();
}
Exemple #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
//    m_parseHtml(new ParseHtml),
    m_httpDownload(new HttpDownload())
{
    ui->setupUi(this);
    ui->progressBar->setValue(0);

//    QThread* thread = new QThread;
//    m_httpDownload->moveToThread(thread);
//    thread->start();

    connect(ui->downloadBtn, SIGNAL(clicked()),
            this, SLOT(startDownload()));

    connect(m_httpDownload, SIGNAL(updateDownloadProgressbar(qint64, qint64)),
            this, SLOT(updateProgressbar(qint64, qint64)));
    connect(m_httpDownload, SIGNAL(outputLog(QString)),
            this, SLOT(appendLog(QString)));
    connect(m_httpDownload, SIGNAL(htmlCount(int)),
            this, SLOT(updateHtmlCount(int)));

    connect(m_httpDownload, SIGNAL(imgCount(int)),
            this, SLOT(updateImgCount(int)));

//    connect(m_parseHtml, SIGNAL(updateLog(QStringList)),
//                this, SLOT(appendLog(QStringList)));

//    connect(m_parseHtml, SIGNAL(downloadImg(QString)),
//                this, SLOT(downloadImg(QString)));
//    connect(m_parseHtml, SIGNAL(updateCount(int)),
//                this, SLOT(updateCount(int)));
}
Exemple #3
0
void DcmtkServerDialog::open() {
#ifdef VRN_DICOMLOADER
    if (listWidget_->getSelectedSeriesInstanceUID().empty())
        return;

    int numImages = listWidget_->getSelectedNumImages();
    std::cout << "Downloading " << numImages << " images\n";
    pd_ = new QProgressDialog("Downloading...", "Cancel", 0, numImages);
    connect(pd_, SIGNAL(canceled()), this, SLOT(cancelDownload()));
    pd_->setValue(0);

    t_ = new QTimer(this);
    connect(t_, SIGNAL(timeout()), this, SLOT(updateProgressbar()));
    t_->start(100);


    QString targetPath = outputDirectory_->text();
    if (targetPath.isEmpty())
        return;

    repaint();

    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    std::string configFile = (QApplication::applicationDirPath()
                              + "/dicomloader-storescp.cfg").toStdString();

    if (!voreen::DcmtkMoveSCU::init(servers_[currentConf_].destAE_.toStdString(),
                                    servers_[currentConf_].inPort_,
                                    servers_[currentConf_].hostname_.toStdString(),
                                    servers_[currentConf_].serverPort_,
                                    security_, configFile))
    {
        QApplication::restoreOverrideCursor();
        QMessageBox::critical(this, "Init Connection",
                              QString("Invalid connection parameters for DicomMoveSCU"),
                              QMessageBox::Ok, QMessageBox::NoButton);

        t_->stop();
        pd_->setValue(numImages);
        return;
    }
    delete dt_;
    dt_ = new DcmtkDownloadThread(targetPath.toStdString(),
                             servers_[currentConf_].callAE_.toStdString(),
                             listWidget_->getSelectedSeriesInstanceUID());
    connect(dt_, SIGNAL(finished()), this, SLOT(downloadFinished()));
    dt_->start();
#else
    hide();
    emit dicomServerFinished();
#endif
}