diff options
Diffstat (limited to 'ui/qt5/pkgcustom.cc')
-rw-r--r-- | ui/qt5/pkgcustom.cc | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/ui/qt5/pkgcustom.cc b/ui/qt5/pkgcustom.cc new file mode 100644 index 0000000..33a56b3 --- /dev/null +++ b/ui/qt5/pkgcustom.cc @@ -0,0 +1,58 @@ +/* + * pkgcustom.cc - Implementation of the UI.Packages.Custom page + * horizon-qt5, the Qt 5 user interface for + * Project Horizon + * + * Copyright (c) 2019 Adélie Linux and contributors. All rights reserved. + * This code is licensed under the AGPL 3.0 license, as noted in the + * LICENSE-code file in the root directory of this repository. + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +#include "pkgcustom.hh" + +#include <QGroupBox> +#include <QTreeView> +#include <QVBoxLayout> + +PkgCustomPage::PkgCustomPage(QWidget *parent) : HorizonWizardPage(parent) { + setTitle(tr("Software Selection")); + loadWatermark("software"); + + QLabel *descLabel = new QLabel(tr( + "Choose the software you want to install on this computer.\n\n" + "You may select any category or software package to read a brief description of it.")); + descLabel->setWordWrap(true); + + QTreeView *pkgTree = new QTreeView; + model = new PkgItemModel(nullptr, this); + pkgTree->setHeaderHidden(true); + pkgTree->setModel(model); + pkgTree->setUniformRowHeights(true); + + QItemSelectionModel *selModel = pkgTree->selectionModel(); + connect(selModel, &QItemSelectionModel::currentChanged, [=](const QModelIndex ¤t){ + QVariant data = model->data(current, Qt::StatusTipRole); + if(data.isValid()) { + pkgDescLabel->setText(data.toString()); + } + }); + + pkgDescLabel = new QLabel(tr("Select an item to view its description.\n\n ")); + pkgDescLabel->setWordWrap(true); + QGroupBox *descBox = new QGroupBox("Description"); + QVBoxLayout *descLayout = new QVBoxLayout; + descLayout->addWidget(pkgDescLabel); + descBox->setLayout(descLayout); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(descLabel); + layout->addWidget(pkgTree); + layout->addWidget(descBox); + setLayout(layout); +} + +void PkgCustomPage::initializePage() { + model->setPackageList(&(horizonWizard()->packages)); +} |