| 109 | } |
| 110 | |
| 111 | MenuSectionCollapseWidget *PkgZipWidget::createBrowserSection(QWidget *parent) |
| 112 | { |
| 113 | MenuSectionCollapseWidget *browserSection = createSection( |
| 114 | "Install Package", "Use the file browser to choose the desired package and then install it!", parent); |
| 115 | |
| 116 | QWidget *w = new QWidget(browserSection); |
| 117 | QGridLayout *wLay = new QGridLayout(w); |
| 118 | wLay->setMargin(0); |
| 119 | |
| 120 | m_fileBrowser = new FileBrowserWidget(FileBrowserWidget::OPEN_FILE); |
| 121 | m_fileBrowser->setFilter("*.zip"); |
| 122 | m_fileBrowser->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); |
| 123 | |
| 124 | QLineEdit *fileBrowserEdit = m_fileBrowser->lineEdit(); |
| 125 | connect(fileBrowserEdit, &QLineEdit::textChanged, this, &PkgZipWidget::fileBrowserEvent); |
| 126 | |
| 127 | m_installBtn = new InstallBtn(w); |
| 128 | connect(m_installBtn, &QPushButton::clicked, this, |
| 129 | [this, fileBrowserEdit]() { Q_EMIT installClicked(fileBrowserEdit->text()); }); |
| 130 | |
| 131 | m_warningLabel = new QLabel(w); |
| 132 | Style::setStyle(m_warningLabel, style::properties::label::warning); |
| 133 | m_warningLabel->setVisible(false); |
| 134 | m_warningLabel->setWordWrap(true); |
| 135 | |
| 136 | wLay->addWidget(m_fileBrowser, 0, 0); |
| 137 | wLay->addWidget(m_installBtn, 0, 1); |
| 138 | wLay->addWidget(m_warningLabel, 1, 0); |
| 139 | |
| 140 | browserSection->contentLayout()->addWidget(w); |
| 141 | browserSection->contentLayout()->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); |
| 142 | |
| 143 | return browserSection; |
| 144 | } |
| 145 | |
| 146 | #include "moc_pkgzipwidget.cpp" |
nothing calls this directly
no test coverage detected