File: downloadstatus.cpp

package info (click to toggle)
youtubedl-gui 3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 336 kB
  • sloc: cpp: 729; makefile: 3
file content (44 lines) | stat: -rw-r--r-- 979 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "downloadstatus.h"
#include "ui_downloadstatus.h"
#include <QIcon>
#include <QCloseEvent>

downloadStatus::downloadStatus(QWidget *parent) :
    QDialog(parent),
    download_ui(new Ui::downloadStatus)
{
    download_ui->setupUi(this);
    this->setWindowTitle("Progress");
    this->setWindowIcon(QIcon::fromTheme("youtubedl-gui"));

    //add minimize button
    this->setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint);

    //remove help button
    this->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}

downloadStatus::~downloadStatus()
{
    delete download_ui;
}

Ui::downloadStatus* downloadStatus::getUiInstance() {
    return this->download_ui;
}

void downloadStatus::closeDownloadWindow() {
    download_lock = false;
    this->close();
}

void downloadStatus::closeEvent(QCloseEvent* event) {
    if (download_lock) {
        emit openCancelWindow();
        event->ignore();
    }

    else {
        event->accept();
    }
}