File indexing completed on 2022-09-27 16:24:28

0001 /***************************************************************************
0002  *   Copyright (C) 2009-2010 by Daniel Nicoletti                           *
0003  *   dantti12@gmail.com                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; see the file COPYING. If not, write to       *
0017  *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  *
0018  *   Boston, MA 02110-1301, USA.                                           *
0019  ***************************************************************************/
0020 
0021 #ifndef BROWSE_VIEW_H
0022 #define BROWSE_VIEW_H
0023 
0024 #include "ui_BrowseView.h"
0025 
0026 class PackageModel;
0027 
0028 class ApplicationSortFilterModel;
0029 class KpkSearchableTreeView;
0030 class BrowseView : public QWidget, Ui::BrowseView
0031 {
0032     Q_OBJECT
0033 public:
0034     explicit BrowseView(QWidget *parent = nullptr);
0035     ~BrowseView() override;
0036 
0037     void init(PackageKit::Transaction::Roles roles);
0038 
0039     void showInstalledPanel(bool visible);
0040     void setCategoryModel(QAbstractItemModel *model);
0041     void setParentCategory(const QModelIndex &index);
0042     PackageModel*                  model() const;
0043     ApplicationSortFilterModel* proxy() const;
0044     KPixmapSequenceOverlayPainter*    busyCursor() const;
0045 
0046     void disableExportInstalledPB();
0047     bool goBack();
0048     void cleanUi();
0049     bool isShowingSizes() const;
0050 
0051 Q_SIGNALS:
0052     void categoryActivated(const QModelIndex &index);
0053 
0054 public Q_SLOTS:
0055     void enableExportInstalledPB();
0056 
0057 private Q_SLOTS:
0058     void showVersions(bool enabled);
0059     void showArchs(bool enabled);
0060     void showOrigins(bool enabled);
0061     void showSizes(bool enabled);
0062     void on_packageView_customContextMenuRequested(const QPoint &pos);
0063     void on_packageView_clicked(const QModelIndex &);
0064     void ensureVisible(const QModelIndex &index);
0065     void on_categoryMvLeft_clicked();
0066     void on_categoryMvRight_clicked();
0067 
0068     void on_exportInstalledPB_clicked();
0069     void on_importInstalledPB_clicked();
0070 
0071 private:
0072     bool showPageHeader() const;
0073 
0074     QAction                       *m_showPackageVersion;
0075     QAction                       *m_showPackageArch;
0076     QAction                       *m_showPackageOrigin;
0077     QAction                       *m_showPackageSizes;
0078     PackageModel                  *m_model;
0079     ApplicationSortFilterModel    *m_proxy;
0080     KpkSearchableTreeView         *m_packageView;
0081     KPixmapSequenceOverlayPainter *m_busySeq;
0082 };
0083 
0084 #endif