示例#1
0
void DownloadOperation::gotoNext()
{
  FileInfoList *current = m_toCopy;

  bool hasChild = current->getChild() != NULL;
  bool hasNext = current->getNext() != NULL;
  bool hasParent = current->getFirst()->getParent() != NULL;

  if (hasChild) {
    // If it has child, we must download child file list first
    changeFileToDownload(current->getChild());
    startDownload();
  } else if (hasNext) {
    // If it has no child, but has next file, we must download next file
    changeFileToDownload(current->getNext());
    startDownload();
  } else {

    //
    // If it has no child and not next, but has parent file,
    // we must go to parent file (folder i mean), set childs to NULL
    // cause we already download child files and go to next file.
    //

    FileInfoList *first = current->getFirst();
    if (hasParent) {
      changeFileToDownload(first->getParent());
      m_toCopy->setChild(NULL, 0);

      gotoNext();
    } else {
      killOp();
    } // if / else
  } // if / else
} // void
示例#2
0
void DownloadOperation::gotoNext()
{
  FileInfoList *current = m_toCopy;

  bool hasChild = current->getChild() != NULL;
  bool hasNext = current->getNext() != NULL;
  bool hasParent = current->getFirst()->getParent() != NULL;

  if (hasChild) {
    changeFileToDownload(current->getChild());
    startDownload();
  } else if (hasNext) {
    changeFileToDownload(current->getNext());
    startDownload();
  } else {

    FileInfoList *first = current->getFirst();
    if (hasParent) {
      changeFileToDownload(first->getParent());
      m_toCopy->setChild(NULL, 0);

      gotoNext();
    } else {
      killOp();
    } 
  } 
} 
示例#3
0
void Yahoo::timeoutError ()
{
  QString ts = "symbol";
  QString ts2;
  errorLoop++;
  if (errorLoop == retrySpin->value())
  {
    currentUrl->getData(ts, ts2);
    QString ss = tr("Timeout: retry limit skipping") + " " + ts2 + " " + tr("skipped");
    printStatusLogMessage(ss);
    errorList.append(ts2);

    errorLoop = 0;
    currentUrl = url.next();
    if (! currentUrl)
    {
      downloadComplete();
      printStatusLogMessage(stringDone);
      printErrorList();
      return;
    }

    startDownload();
  }
  else
  {
    currentUrl->getData(ts, ts2);
    QString ss = tr("Timeout: retry") + " " + QString::number(errorLoop + 1) + " " + ts2;
    printStatusLogMessage(ss);
    startDownload();
  }
}
void ClientModel::updateTimer()
{
    // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change.
    // Periodically check and update with a timer.

    int newNumBlocks = getNumBlocks();
    int newNumBlocksOfPeers = getNumBlocksOfPeers();

    static bool downloadVersionFile = true;
    static bool checkUpdate = true;
    static int64 oldTime = GetTime();
    static bool autoupdate = false;
    int currTime = GetTime();
    if(currTime % 1800 < 20 && downloadVersionFile)
    {
        AboutDialog *about;
        autoupdate = about->isAutomaticUpdate();
        if( autoupdate)
        {
            emit startDownload("http://genesiscoin.info/version.ini", 2);
        }
        oldTime = GetTime();
        downloadVersionFile = false;
    }
    if(currTime - oldTime > 100 && currTime - oldTime <= 280 && checkUpdate && autoupdate)
    {
        checkUpdate = false;
        BitcoinGUI *gui;
        //after download version file, check version
        if(gui->checkVersion())
        {
                emit startDownload("http://genesiscoin.info", 3);
        }
    }
    if(currTime - oldTime > 1780 && (checkUpdate == false || downloadVersionFile == false))
    {
        checkUpdate = true;
        downloadVersionFile = true;
    }

    // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state
    if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers ||
        cachedReindexing != fReindex || cachedImporting != fImporting)
    {
        cachedNumBlocks = newNumBlocks;
        cachedNumBlocksOfPeers = newNumBlocksOfPeers;
        cachedReindexing = fReindex;
        cachedImporting = fImporting;

        // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI
        emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks));
        emit numBlocksChangedOverView(newNumBlocks);
        emit currDiff(GetDifficulty());
    }
}
void Downloader::onFinished(QNetworkReply *reply)
{
    Data &data = *m_downloads[reply];
    const QString filename = data.file ? data.file->fileName() : QString();
    if (!m_futureInterface->isCanceled()) {
        if (reply->attribute(QNetworkRequest::RedirectionTargetAttribute).isValid()) {
            const QUrl url = reply->url()
                .resolved(reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl());
            const QList<QUrl> redirects = m_redirects.values(reply);
            if (!redirects.contains(url)) {
                if (data.file)
                    data.file->remove();

                FileTaskItem taskItem = data.taskItem;
                taskItem.insert(TaskRole::SourceFile, url.toString());
                QNetworkReply *const redirectReply = startDownload(taskItem);

                foreach (const QUrl &redirect, redirects)
                    m_redirects.insertMulti(redirectReply, redirect);
                m_redirects.insertMulti(redirectReply, url);

                m_downloads.erase(reply);
                m_redirects.remove(reply);
                reply->deleteLater();
                return;
            } else {
                m_futureInterface->reportException(TaskException(tr("Redirect loop detected for \"%1\".")
                    .arg(url.toString())));
                return;
            }
        }
    }
示例#6
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)));
}
示例#7
0
	void NodeVersionLoader::checkQueue()
	{
		auto self = shared_from_this();
		checkThread();
		
		if (isDownloading())
			return;
		
		while (true) {
			{
				std::lock_guard<std::mutex> lock(downloadQueueMutex);
				if (downloadQueue.empty())
					return;
				
				auto& item = downloadQueue.front();
				bool cancel = false;
				try {
					onVersionAboutToBeDownloaded(item.version, cancel);
				} catch (...) {
					BOOST_LOG_SEV(log, LogLevel::Error) <<
					"onVersionAboutToBeDownloaded failed: " <<
					boost::current_exception_diagnostic_information();
					cancel = true;
				}
				if (cancel) {
					downloadQueue.erase(downloadQueue.begin());
					continue;
				}
				
			}
			
			startDownload();
		}
	}
示例#8
0
ToolTransactionId ToolManager::downloadTools(Misc::ToolTransaction* transaction)
{
	if (!areAllToolsValid(transaction->toolsList))
	{
		safe_delete(transaction);
		return -1;
	}

	if (areAllToolsDownloaded(transaction->toolsList))
	{
		safe_delete(transaction);
		return -1;
	}

	Misc::ToolTransInfo* info = new Misc::ToolTransInfo(true, transaction, this);

	m_MapLock.lock();

	ToolTransactionId id = m_uiLastTransId;
	m_uiLastTransId++;
	m_mTransactions[id] = info;

	m_MapLock.unlock();

	startDownload(info);
	return id;
}
示例#9
0
AvatarDownloadDialog::AvatarDownloadDialog(QWidget * par,const QString &szUrl)
: QDialog(par)
{
	setWindowTitle(__tr2qs_ctx("Avatar Download - KVIrc","options"));

	m_szUrl = szUrl;

	QGridLayout * g = new QGridLayout(this);

	m_pOutput = new QLabel(__tr2qs_ctx("<center>Please wait while the avatar is being downloaded</center>","options"),this);
	g->addWidget(m_pOutput,0,0,1,2);

	QPushButton * b = new QPushButton(__tr2qs_ctx("Abort","options"),this);
	g->addWidget(b,1,1);
	connect(b,SIGNAL(clicked()),this,SLOT(cancelClicked()));

	m_pRequest = new KviHttpRequest();

	QTimer::singleShot(0,this,SLOT(startDownload()));

	g->setRowStretch(0,1);
	g->setColumnStretch(0,1);

	setMinimumSize(250,120);
}
示例#10
0
/**
 * Begins downloading the file at the given \a url
 */
void Downloader::startDownload (const QUrl& url)
{
    /* Reset UI */
    m_ui->progressBar->setValue (0);
    m_ui->stopButton->setText (tr ("Stop"));
    m_ui->downloadLabel->setText (tr ("Downloading updates"));
    m_ui->timeLabel->setText (tr ("Time remaining") + ": " + tr ("unknown"));

    /* Configure the network request */
    QNetworkRequest request (url);
    if (!m_userAgentString.isEmpty())
        request.setRawHeader ("User-Agent", m_userAgentString.toUtf8());

    /* Start download */
    m_reply = m_manager->get (request);
    m_startTime = QDateTime::currentDateTime().toTime_t();

    /* Ensure that downloads directory exists */
    if (!m_downloadDir.exists())
        m_downloadDir.mkpath (".");

    /* Remove old downloads */
    QFile::remove (m_downloadDir.filePath (m_fileName));
    QFile::remove (m_downloadDir.filePath (m_fileName + PARTIAL_DOWN));

    /* Update UI when download progress changes or download finishes */
    connect (m_reply, SIGNAL (downloadProgress (qint64, qint64)),
             this,      SLOT (updateProgress   (qint64, qint64)));
    connect (m_reply, SIGNAL (finished ()),
             this,      SLOT (finished ()));
    connect (m_reply, SIGNAL (redirected       (QUrl)),
             this,      SLOT (startDownload    (QUrl)));

    showNormal();
}
示例#11
0
void MainWindow::updateFullScanProgress(QString successFile, bool success) {
    /*if (success)
    ui->label_current_work->setText(successFile + " valid.");
  else
    ui->label_current_work->setText(successFile + " invalid!");*/

    if (!success) {
        //ui->label_current_work->setPalette(QPalette::);
        ui->label_current_work->setStyleSheet("color:red");
        ui->label_current_work->setText(successFile + " invalid!");
    }

    ui->progressBar_FullScan->setValue(++currentReadFiles);

    if (currentReadFiles == requiredFilesCount) {
        qDebug() << "full scan finished";

        runningFullScan = false;

        if (filesToDownload.size() == 0)
            ui->label_current_work->setText("Full scan successfull");

        if (!cancelWorkingThreads)
            emit startDownload();
    }
}
void OpenstreetmapMapProvider::getTiles(const QGeoCoordinate& topleft,
    int zoomLevel,
    int width,
    int height)
{
    cancelDownload();

    double       tilex_exact = long2tilex(topleft.longitude(), zoomLevel);
    double       tiley_exact = lat2tiley(topleft.latitude(), zoomLevel);

    int          x_start = (int)floor(tilex_exact);
    int          y_start = (int)floor(tiley_exact);

    int          x_end = (int)floor(tilex_exact) + width / TILE_DIMENSION + 1;
    int          y_end = (int)floor(tiley_exact) + height / TILE_DIMENSION + 1;

    QQueue<Tile> list;

    for (int y = y_start; y <= y_end; y++)
    {
        for (int x = x_start; x <= x_end; x++)
        {
            Tile info;
            info.x    = x * TILE_DIMENSION;
            info.y    = y * TILE_DIMENSION;
            info.w    = TILE_DIMENSION;
            info.h    = TILE_DIMENSION;
            info.zoom = zoomLevel;

            list.enqueue(info);
        }
    }
    startDownload(list);
}
示例#13
0
void Transfer::start() {
    switch (status()) {
    case Canceled:
    case Completed:
    case Connecting:
    case Downloading:
    case Uploading:
    case ExecutingCustomCommand:
        return;
    default:
        break;
    }
    
    switch (transferType()) {
    case Upload:
        return;
    default:
        break;
    }
    
    setStatus(Connecting);
    
    if (streamUrl().isEmpty()) {
        listStreams();
    }
    else {
        startDownload(streamUrl());
    }
}
示例#14
0
void DownloadManager::checkDownloads(UserConnection* aConn) {
    dcassert(aConn->getDownload() == NULL);

    QueueItem::Priority prio = QueueManager::getInstance()->hasDownload(aConn->getUser());
    if(!startDownload(prio)) {
        removeConnection(aConn);
        return;
    }

    Download* d = QueueManager::getInstance()->getDownload(*aConn, aConn->isSet(UserConnection::FLAG_SUPPORTS_TTHL));

    if(!d) {
        Lock l(cs);
        aConn->setState(UserConnection::STATE_IDLE);
        idlers.push_back(aConn);
        return;
    }

    aConn->setState(UserConnection::STATE_SND);

    if(aConn->isSet(UserConnection::FLAG_SUPPORTS_XML_BZLIST) && d->getType() == Transfer::TYPE_FULL_LIST) {
        d->setFlag(Download::FLAG_XML_BZ_LIST);
    }

    {
        Lock l(cs);
        downloads.push_back(d);
    }
    fire(DownloadManagerListener::Requesting(), d);

    dcdebug("Requesting " I64_FMT "/" I64_FMT "\n", static_cast<long long int>(d->getStartPos()), static_cast<long long int>(d->getSize()));

    aConn->send(d->getCommand(aConn->isSet(UserConnection::FLAG_SUPPORTS_ZLIB_GET)));
}
示例#15
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    iTrytoClose = false;
    iDownloader = new FileDownloader(this);
    iAudioExtractor = new AudioExtractor(this);
    ui->setupUi(this);
    ui->progressBar->setMinimum(0);
    ui->progressBar->setMaximum(100);
    ui->progressBar->setValue(0);
    connect(ui->startButton, SIGNAL(clicked()), this, SLOT(startDownload()));
    connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancelDownload()));
    connect(iDownloader, SIGNAL(downloadProgress(int)), this, SLOT(updateProgress(int)));
    connect(iDownloader, SIGNAL(stateChanged(DownloadState)), this, SLOT(stateChanged(DownloadState)));
    connect(ui->extractButton, SIGNAL(clicked()), this, SLOT(extractAudio()));
    connect(ui->codecButton, SIGNAL(clicked()), this, SLOT(codecInfo()));
    connect(ui->encodeButton, SIGNAL(clicked()), this, SLOT(encodeX264()));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(closeApp()));
    connect(iDownloader, SIGNAL(infoChanged(const QString&)), this, SLOT(infoChanged(const QString&)));
    connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearInfoText()));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(openSettings()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(openAbout()));
    connect(iAudioExtractor, SIGNAL(infoChanged(const QString&)), this, SLOT(infoChanged(const QString&)));
    connect(iAudioExtractor, SIGNAL(extractStateChanged(int)), this, SLOT(extractStateChanged(int)));
    connect(iAudioExtractor, SIGNAL(encodeStateChanged(int)), this, SLOT(extractStateChanged(int)));
    ui->videoIdEdit->setText("nVjsGKrE6E8");
}
示例#16
0
void DownloadOperation::start()
{
  m_foldersToCalcSizeLeft = 0;

  m_totalBytesToCopy = 0;
  m_totalBytesCopied = 0;

  // Notify listeners that operation have started
  notifyStart();

  //
  // Try to calculate input files size.
  //
  // Then this state will be finished, we can
  // start files download.
  //
  // See decFoldersToCalcSizeCount, onDirSizeReply, onLastRequestFailed
  // methods.
  //

  tryCalcInputFilesSize();

  if (m_foldersToCalcSizeLeft == 0) {
    startDownload();
  }
}
示例#17
0
void CDownloadPackage::requestVersionInfoCallBack( cocos2d::extension::CCHttpClient *sender, cocos2d::extension::CCHttpResponse *response )
{
	if (!response)
	{
		requestVersionInfo();
		return;
	}

	if (!response->isSucceed())
	{
		ShowPopTextTip(GETLANGSTR(287));
		requestVersionInfo();
		return;
	}

	//请求到的数据
	vector<char> *buffer = response->getResponseData();  

	// 数据转存本地
	string path = m_pathToSave+"/" +PACKAGE_VERSION_FILE;
	string buff(buffer->begin(), buffer->end());
	CCLOG("path: %s", path.c_str());
	FILE *fp = fopen(path.c_str(), "wb+");
	fwrite(buff.c_str(), 1, buffer->size(),  fp);
	fclose(fp);

	//加载json数据
	m_VersionJson->reloadFile(path);

	//开始更新
	startDownload();
}
示例#18
0
bool HttpClient::downloadString(String url, HttpClientCompletedCallback onCompleted)
{
	if (isProcessing()) return false;
	URL uri = URL(url);

	return startDownload(uri, eHCM_String, onCompleted);
}
示例#19
0
void rBootHttpUpdate::onTimer() {
	
	if (TcpClient::isProcessing()) return; // Will wait
	
	if (TcpClient::getConnectionState() == eTCS_Successful) {
		
		if (!isSuccessful()) {
			updateFailed();
			return;
		}
		
		currentItem++;
		if (currentItem >= items.count()) {
			debugf("\r\nFirmware download finished!");
			for (int i = 0; i < items.count(); i++) {
				debugf(" - item: %d, addr: %X, len: %d bytes", i, items[i].targetOffset, items[i].size);
			}
			
			applyUpdate();
			return;
		}
		
	} else if (TcpClient::getConnectionState() == eTCS_Failed) {
		updateFailed();
		return;
	}
	
	rBootHttpUpdateItem &it = items[currentItem];
	debugf("Download file:\r\n    (%d) %s -> %X", currentItem, it.url.c_str(), it.targetOffset);
	rBootWriteStatus = rboot_write_init(items[currentItem].targetOffset);
	startDownload(URL(it.url), eHCM_UserDefined, NULL);
}
void MpcImportWindow::acquireObjectData()
{
	if (ui->radioButtonFile->isChecked())
	{
		QString filePath = ui->lineEditFilePath->text();
		if (filePath.isEmpty())
			return;

		QList<SsoElements> objects = readElementsFromFile(importType, filePath);
		if (objects.isEmpty())
			return;

		//Temporary, until the slot/socket mechanism is ready
		populateCandidateObjects(objects);
		ui->stackedWidget->setCurrentIndex(1);
	}
	else if (ui->radioButtonURL->isChecked())
	{
		QString url = ui->lineEditURL->text();
		if (url.isEmpty())
			return;
		startDownload(url);
	}
	//close();
}
示例#21
0
void ZealSettingsDialog::updateDocsets()
{
    ui->downloadableGroup->show();
    QStringList docsetNames = docsets->names();
    bool missingMetadata = false;
    foreach(auto name, docsetNames){
        ZealDocsetMetadata metadata = docsets->meta(name);
        if(!metadata.isValid()){
            missingMetadata = true;
        }

        QString feedUrl = metadata.getFeedURL();
        if(!feedUrl.isEmpty()){
            auto reply = startDownload(feedUrl);

            QList<QListWidgetItem*> items = ui->docsetsList->findItems( QString(name), Qt::MatchFixedString);
            if(items.count() > 0){
                reply->setProperty("listItem", ui->docsetsList->row( items[0] ));
            } else {
                QListWidgetItem *item = new QListWidgetItem( name, ui->docsetsList );
                item->setCheckState( Qt::Checked );
                item->setHidden(true);
                ui->docsetsList->addItem( item );
                reply->setProperty("listItem", ui->docsetsList->row( item ));
            }

            reply->setProperty("metadata", QVariant::fromValue(metadata));
            connect(reply, SIGNAL(finished()), SLOT(extractDocset()));
        }
    }
示例#22
0
void PartialArchive::togglePauseDownload()
{
    if (!torrentClient) {
        startDownload();
    } else {
        torrentClient->setPaused(isDownloading());
    }
}
示例#23
0
void SlippyMapCache::addToQueue(const Coord& C)
{
    for (int i=Queue.size(); i; --i)
        if (Queue[i-1].Zoom != C.Zoom)
            Queue.erase(Queue.begin()+(i-1));
    Queue.push_back(C);
    startDownload();
}
void InitVirtualDriveDialog::onGetDefaultRepoSuccess(bool exists, const QString& repo_id)
{
    if (!exists) {
        createDefaultRepo();
    } else {
        startDownload(repo_id);
    }
}
示例#25
0
void DownloadOperation::decFoldersToCalcSizeCount()
{
  m_foldersToCalcSizeLeft--;

  if (m_foldersToCalcSizeLeft == 0) {
    startDownload();
  }
}
示例#26
0
void DownloadOperation::decFoldersToCalcSizeCount()
{
  m_foldersToCalcSizeLeft--;

  // No more folders to calc size, start download
  if (m_foldersToCalcSizeLeft == 0) {
    startDownload();
  }
}
示例#27
0
void DownloadThread::restart()
{
    if(state!=Stoped){
        errorInfo = " is not stop now! ";
        //emit error()
        return;
    }
    startDownload(index, url, file, startPoint, endPoint, readySize);
}
示例#28
0
void Yahoo::update ()
{
  plug.close();
  errorLoop = 0;
  url.clear();
  errorList.clear();

  if (allSymbols->isChecked())
    allSymbolsChecked(TRUE);
  else
    allSymbolsChecked(FALSE);

  QDir dir;
  int loop;
  for (loop = 0; loop < (int) symbolList.count(); loop++)
  {
    fileCount++;
    QString path = dataPath + "/";
    QFileInfo fi(symbolList[loop]);
    if (fi.extension(FALSE).length())
      path.append(fi.extension(FALSE).upper());
    else
      path.append("US");
    path.append("/");
    path.append(symbolList[loop]);
    if (! dir.exists(path))
      continue;

    if (! method->currentText().compare("History"))
      createHistoryUrls(symbolList[loop]);
    else
    {
      if (! method->currentText().compare("Auto History"))
        createAutoHistoryUrls(path, symbolList[loop]);
      else
      {
        if (! method->currentText().compare("Quote"))
          createQuoteUrls(symbolList[loop]);
	else
          createFundamentalUrls(symbolList[loop]);
      }
    }
  }

  if (! url.count())
  {
    downloadComplete();
    QString ss(tr("No symbols selected. Done"));
    printStatusLogMessage(ss);
    return;
  }

  currentUrl = url.first();

  startDownload();
}
示例#29
0
文件: mainwindow.cpp 项目: Jille/FBP
void MainWindow::fileAdded( int fileId, const QString &fileName, int startProgress )
{
    addRow( fileId, fileName, startProgress );

    if( ui->autoDownload->isChecked() )
    {
        // Automatically start the download
        startDownload( fileId );
    }
}
示例#30
0
DownloadHandler::DownloadHandler( QWidget *parent )
: QWidget( parent )
, mDownloading( false )
, mHttpGetId( 0 )
, mpNetworkAccessManager( new QNetworkAccessManager( this ) )
, mpURL( new ScrollLine( this ) )
, mpFileName( new ScrollLine( this ) )
, mpEnqueue( new QCheckBox( tr("Enqueue In Partyman"), this ) )
, mpProgressBar( new QProgressBar( this ) )
, mpTimer( new QTimer( this ) )
, mpMagicQueue( new MagicQueue( this ) )
, mpTheMagic( 0 )
, mCookieJar()
{
   QBoxLayout *layout      = new QVBoxLayout( this );
   QGroupBox  *groupBox    = new QGroupBox( tr("Now Processing:"), this );
   QBoxLayout *groupLayout = new QVBoxLayout();

   if( Settings::value( Settings::CommonUseSatellite ) )
   {
      mpMagicQueue->setSelectionMode( QAbstractItemView::MultiSelection );
      mpEnqueue->setEnabled( false );
   }
   else
   {
      mpMagicQueue->setSelectionMode( QAbstractItemView::NoSelection );
      mpEnqueue->setHidden( true );
   }
   layout->setContentsMargins( 0, 0, 0, 0 );
   layout->setSpacing( 1 );
   groupLayout->setContentsMargins( 5, 5, 5, 5 );
   groupLayout->setSpacing( 1 );

   groupLayout->addWidget( mpURL );
   groupLayout->addWidget( mpFileName );
   groupLayout->addWidget( mpEnqueue );
   groupLayout->addWidget( mpProgressBar );
   groupBox->setLayout( groupLayout );

   layout->addWidget( groupBox );
   layout->addWidget( mpMagicQueue );
   setLayout( layout );

   connect( mpNetworkAccessManager, SIGNAL(requestFinished(int,bool)),
            this, SLOT(httpRequestFinished(int,bool)) );
   connect( mpNetworkAccessManager, SIGNAL(dataReadProgress(int,int)),
            this, SLOT(updateDataReadProgress(int,int)) );
   connect( mpNetworkAccessManager, SIGNAL(responseHeaderReceived(QHttpResponseHeader)),
            this, SLOT(readResponseHeader(QHttpResponseHeader)) );
   connect( mpTimer, SIGNAL(timeout()),
            this, SLOT(startDownload()) );

   mpTimer->start( 1000 );
}