File indexing completed on 2024-04-21 15:02:28

0001 /*
0002     knewstuff3/ui/downloaddialog.h.
0003     SPDX-FileCopyrightText: 2005 Enrico Ros <eros.kde@email.it>
0004     SPDX-FileCopyrightText: 2005-2007 Josef Spillner <spillner@kde.org>
0005     SPDX-FileCopyrightText: 2007 Dirk Mueller <mueller@kde.org>
0006     SPDX-FileCopyrightText: 2007-2009 Jeremy Whiting <jpwhiting@kde.org>
0007     SPDX-FileCopyrightText: 2009-2010 Frederik Gladhorn <gladhorn@kde.org>
0008 
0009     SPDX-License-Identifier: LGPL-2.1-or-later
0010 */
0011 
0012 #ifndef KNEWSTUFF3_UI_DOWNLOADWIDGET_H
0013 #define KNEWSTUFF3_UI_DOWNLOADWIDGET_H
0014 
0015 #include "knewstuff_export.h"
0016 #if KNEWSTUFF_ENABLE_DEPRECATED_SINCE(5, 80)
0017 
0018 #include <QWidget>
0019 
0020 #include "entry.h"
0021 
0022 namespace KNSCore
0023 {
0024 class Engine;
0025 }
0026 
0027 namespace KNS3
0028 {
0029 class DownloadWidgetPrivate;
0030 
0031 /**
0032  * KNewStuff download widget.
0033  *
0034  * The download widget will present items to the user
0035  * for installation, updates and removal.
0036  * Preview images as well as other meta information can be seen.
0037  *
0038  * @since 4.5
0039  */
0040 class KNEWSTUFF_EXPORT DownloadWidget : public QWidget
0041 {
0042     Q_OBJECT
0043 
0044 public:
0045     /**
0046      * Create a download widget that lets the user install, update and uninstall
0047      * contents. It will try to find a appname.knsrc file with the configuration.
0048      * Appname is the name of your application as provided in the about data->
0049      *
0050      * @param parent the parent of the dialog
0051      * @deprecated Since 5.80, use the QML components instead
0052      */
0053     KNEWSTUFF_DEPRECATED_VERSION(5, 80, "Use the QML components instead")
0054     explicit DownloadWidget(QWidget *parent = nullptr);
0055 
0056     /**
0057      * Create a download widget that lets the user install, update and uninstall
0058      * contents. Manually specify the name of a .knsrc file where the
0059      * KHotNewStuff configuration can be found.
0060      *
0061      * @param configFile the name of the configuration file
0062      * @param parent the parent of the dialog
0063      * @deprecated Since 5.80, use the QML components instead
0064      */
0065     KNEWSTUFF_DEPRECATED_VERSION(5, 80, "Use the QML components instead")
0066     explicit DownloadWidget(const QString &configFile, QWidget *parent = nullptr);
0067 
0068     /**
0069      * destructor
0070      */
0071     ~DownloadWidget() override;
0072 
0073     /**
0074      * The list of entries with changed status (installed/uninstalled)
0075      * @return the list of entries
0076      */
0077     KNS3::Entry::List changedEntries();
0078 
0079     /**
0080      * The list of entries that have been newly installed
0081      * @return the list of entries
0082      */
0083     KNS3::Entry::List installedEntries();
0084 
0085     /**
0086      * Set the title for display purposes in the widget's title.
0087      * @param title the title of the application (or category or whatever)
0088      */
0089     void setTitle(const QString &title);
0090 
0091     /**
0092      * Get the current title
0093      * @return the current title
0094      */
0095     QString title() const;
0096 
0097     /**
0098      * @return the engine used by this download widget
0099      * @since 5.30
0100      */
0101     KNSCore::Engine *engine();
0102 
0103 private:
0104     void init(const QString &configFile);
0105 
0106     DownloadWidgetPrivate *const d;
0107     Q_DISABLE_COPY(DownloadWidget)
0108 
0109     Q_PRIVATE_SLOT(d, void slotListViewListMode())
0110     Q_PRIVATE_SLOT(d, void slotListViewIconMode())
0111 
0112     Q_PRIVATE_SLOT(d, void slotProvidersLoaded())
0113     Q_PRIVATE_SLOT(d, void slotEntriesLoaded(const KNSCore::EntryInternal::List &entries))
0114     Q_PRIVATE_SLOT(d, void slotShowDetails(const KNSCore::EntryInternal &entry))
0115     Q_PRIVATE_SLOT(d, void slotShowOverview())
0116 
0117     Q_PRIVATE_SLOT(d, void slotPayloadFailed(const KNSCore::EntryInternal &entry))
0118     Q_PRIVATE_SLOT(d, void slotPayloadLoaded(QUrl url))
0119 
0120     Q_PRIVATE_SLOT(d, void slotResetMessage())
0121     Q_PRIVATE_SLOT(d, void slotNetworkTimeout())
0122     Q_PRIVATE_SLOT(d, void sortingChanged())
0123     Q_PRIVATE_SLOT(d, void slotSearchTextChanged())
0124     Q_PRIVATE_SLOT(d, void slotUpdateSearch())
0125     Q_PRIVATE_SLOT(d, void slotCategoryChanged(int))
0126 
0127     Q_PRIVATE_SLOT(d, void slotInfo(QString provider, QString server, QString version))
0128     Q_PRIVATE_SLOT(d, void slotError(const QString &message))
0129     Q_PRIVATE_SLOT(d, void scrollbarValueChanged(int value))
0130 
0131     friend class DownloadDialog;
0132 };
0133 
0134 }
0135 
0136 #endif
0137 #endif