/*!
    Set the download progress bar value (0 - 100 %). If the given value is 0,
    the progress bar is hidden.

    \param value The progress bar value.
*/
void NmAttachmentListItem::setProgressBarValue(const int value)
{
    NM_FUNCTION;
    
    // First check if the value is 0 or below -> hide progressbar.
    if (0 >= value) {
        removeProgressBar();
        return;
    }

    if (!mProgressBar) {
        mProgressBar = new HbProgressBar(this); 
        mProgressBar->setObjectName("attachmentlistitem_progress");
        mProgressBar->setRange(PROGRESSBAR_MIN,PROGRESSBAR_MAX);
        HbStyle::setItemName(mProgressBar, "progressbar");
        repolish();
    }

    mProgressBar->setProgressValue(value);
    
    // Start hiding the count down.
    if (PROGRESSBAR_MAX <= value){
        hideProgressBar();
    }
}
void StatGetterThread::onStart()
{
    setLabel("Retrieving files count..");
    emit showLabel();
    emit setProgressRange(0, 0);
    emit setProgressValue(0);
    emit showProgressBar();

    FillPreAnalysisTree();
    const size_t totalValue = preAnalysisTree_.size();

    setLabel("Calculating statistics..");
    emit setProgressRange(0, totalValue);
    emit setProgressValue(0);

    FillStatTreeByPath();
    GetSubdirsCount();

    emit setProgressValue(totalValue);

    emit hideLabel();
    emit hideProgressBar();

    emit finished();
}
Exemple #3
0
void CModListView::downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors)
{
    QString title = "Download failed";
    QString firstLine = "Unable to download all files.\n\nEncountered errors:\n\n";
    QString lastLine = "\n\nInstall successfully downloaded?";

    // if all files were d/loaded there should be no errors. And on failure there must be an error
    assert(failedFiles.empty() == errors.empty());

    if (savedFiles.empty())
    {
        // no successfully downloaded mods
        QMessageBox::warning(this, title, firstLine + errors.join("\n"), QMessageBox::Ok, QMessageBox::Ok );
    }
    else if (!failedFiles.empty())
    {
        // some mods were not downloaded
        int result = QMessageBox::warning (this, title, firstLine + errors.join("\n") + lastLine,
                                           QMessageBox::Yes | QMessageBox::No, QMessageBox::No );

        if (result == QMessageBox::Yes)
            installFiles(savedFiles);
    }
    else
    {
        // everything OK
        installFiles(savedFiles);
    }

    // remove progress bar after some delay so user can see that download was complete and not interrupted.
    QTimer::singleShot(1000, this,  SLOT(hideProgressBar()));

    dlManager->deleteLater();
    dlManager = nullptr;
}
IProgressWorker::IProgressWorker(QProgressBar* progBar, QLabel* label,
         QObject* parent) :
    QObject(parent)
{
   connect(this, SIGNAL(setProgressRange(int,int)), progBar,
           SLOT(setRange(int,int)));
   connect(this, SIGNAL(setProgressValue(int)), progBar, SLOT(setValue(int)));
   connect(this, SIGNAL(showProgressBar()), progBar, SLOT(show()));
   connect(this, SIGNAL(hideProgressBar()), progBar, SLOT(hide()));

   connect(this, SIGNAL(setLabel(QString)), label, SLOT(setText(QString)));
   connect(this, SIGNAL(showLabel()), label, SLOT(show()));
   connect(this, SIGNAL(hideLabel()), label, SLOT(hide()));
}
Exemple #5
0
void CModListView::on_pushButton_clicked()
{
    delete dlManager;
    dlManager = nullptr;
    hideProgressBar();
}