Пример #1
0
void DFileChooseInput::selectFile() {
    QFileDialog fileDlg(this);
    fileDlg.setViewMode( QFileDialog::Detail);
    fileDlg.setFileMode(QFileDialog::ExistingFile);
    fileDlg.setNameFilter("ISO (*.iso);;");
    if (QFileDialog::Accepted == fileDlg.exec()) {
        text_ = fileDlg.selectedFiles().first();
        edit_->setText(text_);
        emit filedSelected(text_);
    }
}
Пример #2
0
void DWindowUI::AddOptionUI(QBoxLayout *top) {
    QVBoxLayout *option = new QVBoxLayout();
    option->setSpacing(7);

    //add close button
    QHBoxLayout *btlayout = new QHBoxLayout();
    QPushButton *closeBt = new QPushButton();
    QString style = "QPushButton{"
        "background:url(:/ui/images/window_close_normal.png);"
        "border:0px;"
    "}"
    "QPushButton:hover{"
        "background:url(:/ui/images/window_close_hover.png);"
        "border:0px;"
    "}"
    "QPushButton:pressed{"
        "background:url(:/ui/images/window_close_press.png);"
        "border:0px;"
    "}";

    closeBt->setStyleSheet(style);
    QPixmap pixmap (":/ui/images/window_close_normal.png");
    closeBt->setFixedSize(pixmap.size());

    connect(closeBt, SIGNAL(clicked()), this, SLOT(close()));

    btlayout->setMargin(3);
    btlayout->addWidget(closeBt);
    btlayout->setAlignment(closeBt, Qt::AlignRight);

    //Add Logo
    QHBoxLayout *logolayout = new QHBoxLayout();
    QLabel *logolabel = new QLabel();
    logolabel->setPixmap(QPixmap(":/ui/images/logo.png"));

    logolayout->addSpacing(50);
    logolayout->addWidget(logolabel);

    QLabel *versionlabel = new QLabel("<p style='color:white; font-size:10px;'>0.99</p>");
    logolayout->addWidget(versionlabel);
    logolayout->setAlignment(versionlabel, Qt::AlignBottom);
    logolayout->addStretch();

    option->addLayout(btlayout);
    option->addLayout(logolayout);

    //Add Hint
    QLabel *easylabel = new QLabel(tr("<p style='color:white; font-size:14px;'>Easy to use without redundancy</p>"));
    easylabel->setFixedWidth(labelMaxWidth);
    option->addWidget(easylabel);

    //Add Description
    QString descriptions = tr("<a style='color:#a7a7a7; font-size:11px;'>Welcome to Deepin Boot Maker. After setting a few options, you'll be able to create a Deepin OS Startup Disk, which supports both BIOS and </a>"
            "<a style='color:#ebab4c; font-size:11px;'>UEFI</a><a style='color:#a7a7a7; font-size:11px;'> boot.</a>");
    QLabel *descriptionslabel = new QLabel(descriptions);
    descriptionslabel->setFixedWidth(labelMaxWidth);
    descriptionslabel->setWordWrap(true);
    option->addWidget(descriptionslabel);

    //Add select option layout
    selectLayout_ = new QVBoxLayout();

    //Add select iso hint
    QLabel *selectISO = new QLabel(tr("<p style='color:white; font-size:12px;'>Select the ISO File:</p>"));
    selectISO->setFixedWidth(labelMaxWidth);
    selectLayout_->addWidget(selectISO);

    isoFile_ = new DFileChooseInput();
    isoFile_->setFixedHeight(22);
    isoFile_->setFixedWidth(210);
    connect(isoFile_, SIGNAL(filedSelected(QString)), this, SLOT(fileSelect(QString)));

    selectLayout_->addWidget(isoFile_);

    //Add select usb driver hint
    QLabel *selectUSB = new QLabel(tr("<p style='color:white; font-size:12px;'>Select the USB Flash Drive:</p>"));
    selectISO->setFixedWidth(labelMaxWidth);
    selectLayout_->addWidget(selectUSB);

    usbDriver_ = new DComboBox();
    usbDriver_->setFixedWidth(210);

    selectLayout_->addWidget(usbDriver_);


    formatDisk_ = new DCheckBox(tr("<p style='color:white; font-size:12px;'>Format USB flash disk before installation to improve the making success rate.</p>"));
    formatDisk_->setFixedWidth(labelMaxWidth);
    connect(formatDisk_, SIGNAL(clicked()), this, SLOT(confirmFormat()));

    selectLayout_->addWidget(formatDisk_);

    bisoMode_ = new DCheckBox(tr("<p style='color:white; font-size:12px;'>Support BIOS. Unselect here.</p>"));
    bisoMode_->setFixedWidth(labelMaxWidth);
    selectLayout_->addWidget(bisoMode_);

    option->addStretch();
    option->addLayout(selectLayout_);

    option->addSpacing(10);
    actionLayout_ = new QHBoxLayout();
    startBt_ = new DPushButton(tr("Start"));
    connect(startBt_, SIGNAL(clicked()), this, SLOT(start()));

    actionLayout_->addSpacing(50);
    actionLayout_->addWidget(startBt_);
    actionLayout_->addStretch();
    actionLayout_->setAlignment(startBt_, Qt::AlignCenter);

    option->addStretch();
    option->addLayout(actionLayout_);
    option->addStretch();
    option->addStretch();

    top->addLayout(option);
}