void DownloadsManager::downloadFile(QString token, QString id, QString fileName)
{
    if (!downloadDir.exists(fileName)) {
        FileDownloader* t = new FileDownloader(fileName, this);
        connect(t, SIGNAL(fileDownloaded()), this, SLOT(fileDownloaded()));
        t->startDownload(token, id);
    }
    else fileDownloaded();
}
void UpdateChecker::checkForUpdates()
{
    FileDownloader *downloader = new FileDownloader();
    connect(downloader, SIGNAL(downloadCompleted(QByteArray)),
            this, SLOT(xmlDownloaded(QByteArray)));
    connect(downloader, SIGNAL(downloadFailed()),
            this, SIGNAL(updateIsNotAvailable()));
    downloader->startDownload(application.updateXmlUrl);
}
DownloadWindow::DownloadWindow(QUrl updatePackage,
                               QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::DownloadWindow)
{
    ui->setupUi(this);
    FileDownloader *downloader = new FileDownloader();
    connect(downloader, SIGNAL(downloadCompleted(QByteArray)),
            this, SLOT(downloadingFinished()));
    connect(downloader, SIGNAL(downloadFailed()),
            this, SLOT(downloadingFailed()));
    downloader->startDownload(updatePackage,
                              QStandardPaths::writableLocation(QStandardPaths::DataLocation)
                              + "/software-update-package.exe");
}