diff --git a/src/modules/netinstall/CMakeLists.txt b/src/modules/netinstall/CMakeLists.txt new file mode 100644 index 000000000..49b83b6b5 --- /dev/null +++ b/src/modules/netinstall/CMakeLists.txt @@ -0,0 +1,33 @@ +#include(KDEInstallDirs) +#include(KDECMakeSettings) +#include(KDECompilerSettings) + +include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) + +list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" ) + +find_package(ECM 1.0.0 REQUIRED NO_MODULE) +list( APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) + +set(KF5_MIN_VERSION "5.2.0") +find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS + KIO # KIO +) + +calamares_add_plugin( netinstall + TYPE viewmodule + EXPORT_MACRO PLUGINDLLEXPORT_PRO + SOURCES + NetInstallViewStep.cpp + NetInstallPage.cpp + widgets/groupselectionwidget.cpp + UI + page_netinst.ui + widgets/groupselectionwidget.ui + RESOURCES + netinstall.qrc + LINK_LIBRARIES + calamaresui + KF5::KIOCore + SHARED_LIB +) diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp new file mode 100644 index 000000000..a0716dad5 --- /dev/null +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -0,0 +1,139 @@ +#include "NetInstallPage.h" + +#include "./widgets/groupselectionwidget.h" +#include "ui_page_netinst.h" +#include "GlobalStorage.h" +#include "JobQueue.h" +#include "utils/Logger.h" + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + + +NetInstallPage::NetInstallPage( QWidget* parent ) + : QWidget( parent ) + , ui( new Ui::Page_NetInst ) +{ + ui->setupUi( this ); +} + +bool +NetInstallPage::isReady() +{ + // nothing to wait for, the data are immediately ready + // if the user does not select any group nothing is installed + return true; +} + +void NetInstallPage::ReadGroups( const QByteArray& yamlData ) +{ + YAML::Node groups = YAML::Load( yamlData.constData() ); + Q_ASSERT( groups.IsSequence() ); + + for ( YAML::const_iterator it = groups.begin(); it != groups.end(); ++it ) + { + YAML::Node groupDefinition = it->as(); + + QString name( tr( groupDefinition["name"].as().c_str() ) ); + QString description( tr( groupDefinition["description"].as().c_str() ) ); + QStringList packages; + + for ( YAML::const_iterator it = groupDefinition["packages"].begin(); + it != groupDefinition["packages"].end(); ++it ) + packages.append( ( *it ).as().c_str() ); + + m_groups[name].name = name; + m_groups[name].description = description; + m_groups[name].packages = packages; + + if ( groupDefinition["selected"] ) + m_groups[name].selected = groupDefinition["selected"].as(); + + if ( groupDefinition["hidden"] ) + m_groups[name].hidden = groupDefinition["hidden"].as(); + + m_groupOrder.append( name ); + } +} + +void +NetInstallPage::dataIsHere( KJob* job ) +{ + if ( job->error() ) + { + qDebug() << job->errorString(); + ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) ); + return; + } + + auto transferJob = dynamic_cast( job ); + Q_ASSERT( transferJob != nullptr ); + ReadGroups( transferJob->data() ); + + QSignalMapper* mapper = new QSignalMapper( this ); + foreach ( const QString& groupKey, m_groupOrder ) + { + Group group = m_groups[groupKey]; + if ( group.hidden ) + { + // Do not present on view. + continue; + } + + GroupSelectionWidget* groupWidget = new GroupSelectionWidget( group.name, group.description, group.packages, this ); + m_groupWidgets.insert( groupKey, groupWidget ); + ui->groupswidget->layout()->addWidget( groupWidget ); + + mapper->setMapping( groupWidget, groupKey ); + connect( groupWidget, SIGNAL( toggled( bool ) ), mapper, SLOT( map() ) ); + } + + // TODO + emit checkReady( isReady() ); +} + +QStringList NetInstallPage::selectedPackages() const +{ + QStringList selectedPackages; + + // Add all the packages for groups that are toggled in the view. + for ( auto it = m_groupWidgets.constBegin(); it != m_groupWidgets.constEnd(); it++ ) + { + if ( it.value()->isToggled() ) + selectedPackages += m_groups[it.key()].packages; + } + + // Add all the packages for groups that are hidden but selected. + for ( const Group& group : m_groups.values() ) + { + if ( group.hidden && group.selected ) + selectedPackages += group.packages; + } + + return selectedPackages; +} + +void NetInstallPage::loadGroupList() +{ + QString confUrl( + Calamares::JobQueue::instance()->globalStorage()->value( + "groupsUrl" ).toString() ); + + KIO::Job* getJob = KIO::storedGet( confUrl, KIO::Reload, KIO::Overwrite | KIO::HideProgressInfo ); + connect ( getJob, SIGNAL( result( KJob* ) ), this, SLOT( dataIsHere( KJob* ) ) ); +} + +void NetInstallPage::onActivate() +{ + ui->groupswidget->setFocus(); +} diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h new file mode 100644 index 000000000..df557e13c --- /dev/null +++ b/src/modules/netinstall/NetInstallPage.h @@ -0,0 +1,95 @@ +/* + * Copyright 2016, Luca Giambonini + * Lisa Vitolo + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +#ifndef NETINSTALLPAGE_H +#define NETINSTALLPAGE_H + +#include "Typedefs.h" +#include +#include + +// required forward declarations +class KJob; +class QByteArray; +class GroupSelectionWidget; + +namespace Ui +{ +class Page_NetInst; +} + +class NetInstallPage : public QWidget +{ + Q_OBJECT + + // Internal representation of a package group. + struct Group + { + Group() + : Group( "","",false, false ) { } + Group( QString name, QString description, bool selected, bool hidden ) + : name( name ), description( description ), selected( selected ), hidden( hidden ) { } + Group( QString name, QString description ) + : Group( name, description, false, false ) { } + + QString name; + QString description; + QStringList packages; + + // See README.md for a description of these two fields. + bool selected = false; + bool hidden = false; + }; + +public: + NetInstallPage( QWidget* parent = 0 ); + void onActivate(); + + bool isReady(); + + // Retrieves the groups, with name, description and packages, from + // the remote URL configured in the settings. Assumes the URL is already + // in the global storage. This should be called before displaying the page. + void loadGroupList(); + + // Returns the list of packages belonging to groups that are + // selected in the view in this given moment. No data is cached here, so + // this function does not have constant time. + QStringList selectedPackages() const; + +public slots: + void dataIsHere( KJob* ); + +signals: + void checkReady( bool ); + +private: + // Takes the YAML data representing the groups and reads them into the + // m_groups and m_groupOrder internal structures. See the README.md + // of this module to know the format expected of the YAML files. + void ReadGroups( const QByteArray& yamlData ); + + Ui::Page_NetInst* ui; + + QHash m_groups; + // For each group name, store the selection widget to retrieve UI + // properties. + QHash m_groupWidgets; + QList m_groupOrder; +}; + +#endif // NETINSTALLPAGE_H diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp new file mode 100644 index 000000000..f071a3833 --- /dev/null +++ b/src/modules/netinstall/NetInstallViewStep.cpp @@ -0,0 +1,151 @@ +/* + * Copyright 2016, Luca Giambonini + * Lisa Vitolo + * + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +#include "NetInstallViewStep.h" + +#include "JobQueue.h" +#include "GlobalStorage.h" +#include "utils/Logger.h" + +#include "NetInstallPage.h" + +CALAMARES_PLUGIN_FACTORY_DEFINITION( NetInstallViewStepFactory, registerPlugin(); ) + +NetInstallViewStep::NetInstallViewStep( QObject* parent ) + : Calamares::ViewStep( parent ) + , m_widget( new NetInstallPage() ) + , m_nextEnabled( true ) +{ + emit nextStatusChanged( true ); + connect( m_widget, &NetInstallPage::checkReady, + this, &NetInstallViewStep::nextStatusChanged ); +} + + +NetInstallViewStep::~NetInstallViewStep() +{ + if ( m_widget && m_widget->parent() == nullptr ) + m_widget->deleteLater(); +} + + +QString +NetInstallViewStep::prettyName() const +{ + return tr( "NetInstall" ); +} + + +QString +NetInstallViewStep::prettyStatus() const +{ + return m_prettyStatus; +} + + +QWidget* +NetInstallViewStep::widget() +{ + return m_widget; +} + + +void +NetInstallViewStep::next() +{ + emit done(); +} + + +void +NetInstallViewStep::back() +{} + + +bool +NetInstallViewStep::isNextEnabled() const +{ + return m_nextEnabled; +} + + +bool +NetInstallViewStep::isBackEnabled() const +{ + return true; +} + + +bool +NetInstallViewStep::isAtBeginning() const +{ + return true; +} + + +bool +NetInstallViewStep::isAtEnd() const +{ + return true; +} + + +QList< Calamares::job_ptr > +NetInstallViewStep::jobs() const +{ + return m_jobs; +} + + +void +NetInstallViewStep::onActivate() +{ + m_widget->onActivate(); +} + + +void +NetInstallViewStep::onLeave() +{ + cDebug() << "Leaving netinstall, adding packages to be installed" + << "to global storage"; + + if ( !m_widget->selectedPackages().empty() ) + { + QHash packagesWithOperation; + // Gets all packages selected in the page; includes groups that are + // selected by default but not displayed. + packagesWithOperation.insert( "install", m_widget->selectedPackages() ); + + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + gs->insert( "packageOperations", QVariant( packagesWithOperation ) ); + } +} + + +void +NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap ) +{ + if ( configurationMap.contains( "groupsUrl" ) && + configurationMap.value( "groupsUrl" ).type() == QVariant::String ) + { + Calamares::JobQueue::instance()->globalStorage()->insert( + "groupsUrl", configurationMap.value( "groupsUrl" ).toString() ); + m_widget->loadGroupList(); + } +} diff --git a/src/modules/netinstall/NetInstallViewStep.h b/src/modules/netinstall/NetInstallViewStep.h new file mode 100644 index 000000000..f783bb0c4 --- /dev/null +++ b/src/modules/netinstall/NetInstallViewStep.h @@ -0,0 +1,73 @@ +/* + * Copyright 2016, Luca Giambonini + * Lisa Vitolo + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +#ifndef NETINSTALLVIEWSTEP_H +#define NETINSTALLVIEWSTEP_H + +#include + +#include +#include + +#include + +#include + +class NetInstallPage; + +class PLUGINDLLEXPORT NetInstallViewStep : public Calamares::ViewStep +{ + Q_OBJECT + +public: + explicit NetInstallViewStep( QObject* parent = nullptr ); + virtual ~NetInstallViewStep(); + + QString prettyName() const override; + QString prettyStatus() const override; + + QWidget* widget() override; + + void next() override; + void back() override; + + bool isNextEnabled() const override; + bool isBackEnabled() const override; + + bool isAtBeginning() const override; + bool isAtEnd() const override; + + QList< Calamares::job_ptr > jobs() const override; + + void onActivate() override; + + // Leaving the page; store all selected packages for later installation. + void onLeave() override; + + void setConfigurationMap( const QVariantMap& configurationMap ) override; + +private: + NetInstallPage* m_widget; + bool m_nextEnabled; + QString m_prettyStatus; + + QList< Calamares::job_ptr > m_jobs; +}; + +CALAMARES_PLUGIN_FACTORY_DECLARATION( NetInstallViewStepFactory ) + +#endif // NETINSTALLVIEWSTEP_H diff --git a/src/modules/netinstall/README.md b/src/modules/netinstall/README.md new file mode 100644 index 000000000..f0d801dc3 --- /dev/null +++ b/src/modules/netinstall/README.md @@ -0,0 +1,28 @@ +# Netinstall module + +The netinstall module allows distribution maintainers to ship minimal ISOs with only a basic set of preinstall packages. At installation time, the user is presented with the choice to install groups of packages from a predefined list. + +Calamares will then invoke the correct backend to install the packages. + +## How are packages configured? +The *netinstall.conf* file should have this format: + + ---- + groupsUrl: + +The URL must point to a YAML file. Here is a short example of how the YAML file should look. + + - name: "Group name" + description: "Description of the group" + packages: + - lsb-release + - avahi + - grub + - name: "Second group name" + ... + + +The file is composed of a list of entry, each describing one group. The keys *name*, *description* and *packages* are required. + +Two more keys are supported, *hidden* (if true, do not show the group on the page) and *selected* (if true, display the group as selected). Both default to false if not present. +If both keys are set to true for the same group, you are basically creating a "default" group of packages which will always be installed in the user's system. diff --git a/src/modules/netinstall/images/arrow-down.png b/src/modules/netinstall/images/arrow-down.png new file mode 100644 index 000000000..f1b8569da Binary files /dev/null and b/src/modules/netinstall/images/arrow-down.png differ diff --git a/src/modules/netinstall/images/arrow-up.png b/src/modules/netinstall/images/arrow-up.png new file mode 100644 index 000000000..18679693d Binary files /dev/null and b/src/modules/netinstall/images/arrow-up.png differ diff --git a/src/modules/netinstall/module.desc b/src/modules/netinstall/module.desc new file mode 100644 index 000000000..f39082eba --- /dev/null +++ b/src/modules/netinstall/module.desc @@ -0,0 +1,7 @@ +# Module metadata file for netinstall module +# Syntax is YAML 1.2 +--- +type: "view" +name: "netinstall" +interface: "qtplugin" +load: "libcalamares_viewmodule_netinstall.so" diff --git a/src/modules/netinstall/netinstall.conf b/src/modules/netinstall/netinstall.conf new file mode 100644 index 000000000..b87aef43e --- /dev/null +++ b/src/modules/netinstall/netinstall.conf @@ -0,0 +1,2 @@ +--- +groupsUrl: http://chakraos.org/netinstall.php diff --git a/src/modules/netinstall/netinstall.qrc b/src/modules/netinstall/netinstall.qrc new file mode 100644 index 000000000..ab49ebf4f --- /dev/null +++ b/src/modules/netinstall/netinstall.qrc @@ -0,0 +1,6 @@ + + + images/arrow-up.png + images/arrow-down.png + + diff --git a/src/modules/netinstall/netinstall.yaml b/src/modules/netinstall/netinstall.yaml new file mode 100644 index 000000000..e37188312 --- /dev/null +++ b/src/modules/netinstall/netinstall.yaml @@ -0,0 +1,246 @@ +- name: "Default" + description: "Default group" + hidden: true + selected: true + packages: + - base + - chakra-live-skel + - cdemu-client + - lsb-release + - avahi + - grub + # disk utils + - dosfstools + - e2fsprogs + - fuse + - gptfdisk + - jfsutils + - ntfs-3g + - reiserfsprogs + - xfsprogs + # power + - acpi_call + - pmtools + # network + - dnsutils + - iputils + - netcfg + - xinetd + # firmwares + - alsa-firmware + - linux-firmware + # sound + - alsa-lib + - alsa-utils + - gstreamer + - gst-plugins-good + - gst-plugins-bad + - libao + - libcanberra-gstreamer + - libcanberra-pulse + - pulseaudio + - pulseaudio-alsa + # tools + - bash-completion + - hwinfo + - lsof + - man-db + - mlocate + - nano + - openssh + - sudo + - vim + - zsh # :D + # archivers + - p7zip + - unarj + - unrar + - unzip + - zip + # xorg base + - xorg + - xorg-apps + - xorg-fonts-alias + - xorg-fonts-encodings + - xorg-fonts-misc + - xorg-res-utils + - xorg-server + - xorg-server-utils + - xorg-xauth + - xorg-xinit + - xorg-xkb-utils + # xorg video drivers + - xf86-video-apm + - xf86-video-ark + - xf86-video-ati + - xf86-video-chips + - xf86-video-cirrus + - xf86-video-glint + - xf86-video-i128 + - xf86-video-i740 + - xf86-video-intel + - xf86-video-mach64 + - xf86-video-mga + - xf86-video-neomagic + - xf86-video-nouveau + - xf86-video-nv + - xf86-video-openchrome + - xf86-video-r128 + - xf86-video-rendition + - xf86-video-s3 + - xf86-video-s3virge + - xf86-video-savage + - xf86-video-siliconmotion + - xf86-video-sisusb + - xf86-video-tdfx + - xf86-video-trident + - xf86-video-tseng + - xf86-video-v4l + - xf86-video-vesa + - xf86-video-voodoo + - mesa-libgl + # xorg input drivers + - xf86-input-synaptics + - xf86-input-wacom + - xf86-input-evdev + - xf86-input-keyboard + - xf86-input-mouse + # fonts + - terminus-font + - ttf-dejavu + - ttf-liberation + - wqy-microhei + - xorg-fonts-100dpi + - xorg-fonts-75dpi + - xorg-fonts-cyrillic + # additional stuff that needs xorg + - hicolor-icon-theme + # kde + - chakra-common + - qt + - kde-baseapps + - kde-baseapps-dolphin + - kde-baseapps-konsole + - kde-runtime + - kde-workspace + - kdelibs + - kdepimlibs + - kdemultimedia-kmix + - oxygen-icons + - phonon-backend-gstreamer + # chakra theme (including kapudan options) + - chakra-wallpapers-dharma + - chakra-wallpapers-curie + - chakra-wallpapers-descartes + - grub2-themes-sirius + - kapudan-kde-themes-caledonia + - kde-kdm-themes-sirius + - kde-ksplash-themes-sirius + - kde-plasma-themes-caledonia + - python2-imaging + - python2-v4l2capture + - python2-xlib + - caledonia-colors + - yakuake-themes-ronak + # kde (everything else) + - kdeadmin-kcron + - kdeadmin-kuser + - kdeplasma-addons-applets-icontasks + - kdesdk-kate + - kdeutils-ark + - kdeutils-kgpg + - kdeutils-sweeper + # kde network + - kdeplasma-applets-plasma-nm + - networkmanager-dispatcher-ntpd + - kcm-ufw + # applications + - rekonq + - yakuake + # enable systemd-units + - chakra-init-live + # overlay pkgs + - partitionmanager + - octopi-notifier + - kapudan +- name: "Wireless" + description: "Tools for wireless connections" + packages: + - crda + - ndiswrapper + - usb-modeswitch + - wireless-regdb + - wireless_tools + - wpa_supplicant +- name: "CCR" + description: "Tools for the Chakra Community Repository" + packages: + - ccr + - base-devel +- name: "Graphics" + description: "Applications to work with graphics" + packages: + - kdegraphics-gwenview + - kdegraphics-kamera + - kdegraphics-kcolorchooser + - kdegraphics-kgamma + - kdegraphics-kolourpaint + - kdegraphics-kruler + - kdegraphics-ksaneplugin + - kdegraphics-ksnapshot + - kdegraphics-libkdcraw + - kdegraphics-libkexiv2 + - kdegraphics-libkipi + - kdegraphics-libksane + - kdegraphics-mobipocket + - kdegraphics-okular + - kdegraphics-strigi-analyzer + - kdegraphics-svgpart + - kdegraphics-thumbnailers + - imagemagick +- name: "Burning" + description: "Set of packages for disc burning" + packages: + - dvd+rw-tools + - vcdimager + - transcode + - emovix + - k3b + - libdvdcss +- name: "Printing" + description: "Print much?" + packages: + - cups + - gutenprint + - cups-pdf + - kdeadmin-print-manager + - hplip + - epsoneplijs + - epson-inkjet-printer-escpr + - python2-gobject2 + - samba +- name: "Multimedia" + description: "Music and video players" + packages: + - kdemultimedia-dragonplayer + - kdenlive + - amarok +- name: "Miscellaneous" + description: "Useful tools and apps" + packages: + - imagewriter + - tomoyo-tools + - python2-gobject ## needed for systemd-analyze + - clamav + - kdenetwork-kget ## maybe move to a network group? + - kdeplasma-addons-applets-lancelot + - kdeplasma-applets-homerun + - kdeplasma-applets-appmenu-qml + - kdeplasma-addons-runners-characters + - kdeplasma-addons-runners-converter + - kdeplasma-addons-runners-datetime + - kdeplasma-addons-runners-dictionary ##4.10 option + - kdeplasma-addons-runners-spellchecker + - appmenu-qt ## needed for menubar options in 4.10 + - kscreen + diff --git a/src/modules/netinstall/page_netinst.ui b/src/modules/netinstall/page_netinst.ui new file mode 100644 index 000000000..3b7a260ec --- /dev/null +++ b/src/modules/netinstall/page_netinst.ui @@ -0,0 +1,52 @@ + + + Page_NetInst + + + + 0 + 0 + 997 + 474 + + + + + + + + + + + 16777215 + 16777215 + + + + true + + + + + 0 + 0 + 981 + 434 + + + + + + + + + + + + + + + + + + diff --git a/src/modules/netinstall/widgets/groupselectionwidget.cpp b/src/modules/netinstall/widgets/groupselectionwidget.cpp new file mode 100644 index 000000000..c17fa74df --- /dev/null +++ b/src/modules/netinstall/widgets/groupselectionwidget.cpp @@ -0,0 +1,48 @@ +#include "groupselectionwidget.h" + +#include + +GroupSelectionWidget::GroupSelectionWidget( QString name, QString description, QStringList packages, QWidget* parent ) : + QWidget( parent ), + m_isToggled( false ) +{ + ui.setupUi( this ); + + connect( ui.group, SIGNAL( toggled( bool ) ), this, SLOT( toggleGroup( bool ) ) ); + + ui.group->setText( name ); + ui.description->setText( description ); + const int columns = 4; + const int rows = ( packages.size() - 1 ) / columns + 1; + ui.packageview->setRowCount( rows ); + ui.packageview->setColumnCount( columns ); + + ui.packageview->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch ); + + int r = 0, c = 0; + for ( int i = 0; i < packages.size(); ++i ) + { + ui.packageview->setItem( r++,c, new QTableWidgetItem( packages.at( i ) ) ); + if ( r == ui.packageview->rowCount() ) + { + ++c; + r = 0; + } + } + + int rowsShown = 6; + rowsShown = rows < rowsShown ? rows : 6; + ui.packageview->setFixedHeight( rowsShown * ui.packageview->rowHeight( 0 ) ); + ui.packageview->hide(); +} + +void GroupSelectionWidget::toggleGroup( bool isToggled ) +{ + m_isToggled = isToggled; + emit toggled( isToggled ); +} + +bool GroupSelectionWidget::isToggled() const +{ + return m_isToggled; +} diff --git a/src/modules/netinstall/widgets/groupselectionwidget.h b/src/modules/netinstall/widgets/groupselectionwidget.h new file mode 100644 index 000000000..af5a09f68 --- /dev/null +++ b/src/modules/netinstall/widgets/groupselectionwidget.h @@ -0,0 +1,49 @@ +/* + * Copyright 2016, Luca Giambonini + * Lisa Vitolo + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +#ifndef GROUPSELECTIONWIDGET_H +#define GROUPSELECTIONWIDGET_H + +#include "ui_groupselectionwidget.h" + +#include +#include + +// Represents a widget to display and select a group. +class GroupSelectionWidget : public QWidget +{ + Q_OBJECT +public: + explicit GroupSelectionWidget( QString name, QString description, QStringList packages, QWidget* parent = 0 ); + + // Current status of the group: is it selected in the view? + bool isToggled() const; + +signals: + void toggled( bool ); + +public slots: + void toggleGroup( bool isToggled ); + +private: + Ui::GroupSelectionWidget ui; + static QSignalMapper* m_mapper; + + bool m_isToggled; +}; + +#endif // GROUPSELECTIONWIDGET_H diff --git a/src/modules/netinstall/widgets/groupselectionwidget.ui b/src/modules/netinstall/widgets/groupselectionwidget.ui new file mode 100644 index 000000000..1e05839d3 --- /dev/null +++ b/src/modules/netinstall/widgets/groupselectionwidget.ui @@ -0,0 +1,139 @@ + + + GroupSelectionWidget + + + + 0 + 0 + 805 + 62 + + + + + 0 + 0 + + + + Frame + + + + + + + + + group + + + + + + + description + + + + + + + + 0 + 0 + + + + + + + + :/images/arrow-up.png + :/images/arrow-down.png:/images/arrow-up.png + + + true + + + true + + + + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 0 + + + + QAbstractItemView::NoEditTriggers + + + false + + + false + + + false + + + QAbstractItemView::NoSelection + + + false + + + false + + + + + + + + + + + pushButton + toggled(bool) + packageview + setHidden(bool) + + + 772 + 25 + + + 653 + 61 + + + + + + toggled(bool) + +