/*
- This file is part of Faster Application Manager.
+ This file is part of Faster Application Manager.
- Faster Application Manager 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.
+ Faster Application Manager 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.
- Faster Application Manager 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.
+ Faster Application Manager 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 Faster Application Manager. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU General Public License
+ along with Faster Application Manager. If not, see <http://www.gnu.org/licenses/>.
- (C) Heikki Holstila 2010
+ (C) Heikki Holstila 2010
*/
#ifndef PACKAGEVIEW_H
class Settings;
enum UserRoles { UserRoleName=Qt::UserRole, UserRoleVersion, UserRoleDescShort,
- UserRoleMarked, UserRoleInstalled, UserRoleUpgradeable, UserRoleAvailVersion,
- UserRoleCurrentStatFilter, UserRoleCurrentCatFilter, UserRoleBlacklisted };
+ UserRoleMarked, UserRoleInstalled, UserRoleUpgradeable, UserRoleAvailVersion,
+ UserRoleCurrentStatFilter, UserRoleCurrentCatFilter, UserRoleBlacklisted };
class PackageListWidgetItem : public QListWidgetItem
{
public:
- PackageListWidgetItem(Package* p_, QString name_);
+ PackageListWidgetItem(Package* p_, QString name_);
- Package* package() { return iPackage; }
+ Package* package() { return iPackage; }
private:
- Package* iPackage;
+ Package* iPackage;
};
class ListItemDelegate : public QStyledItemDelegate
{
public:
- explicit ListItemDelegate(QObject *parent=0) : QStyledItemDelegate(parent) {}
- virtual ~ListItemDelegate() {}
+ explicit ListItemDelegate(QObject *parent=0) : QStyledItemDelegate(parent) {}
+ virtual ~ListItemDelegate() {}
- void paint (QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
- QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
- void loadIcons();
+ void paint (QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
+ QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
+ void loadIcons();
private:
- ListItemDelegate(const ListItemDelegate& old);
- ListItemDelegate operator= (const ListItemDelegate& old);
-
- QPixmap iDefaultIcon;
- QPixmap iIconPkgInstall;
- QPixmap iIconPkgUpgrade;
- QPixmap iIconPkgRemove;
- QPixmap iIconPkgNoOpInstalled;
- QPixmap iIconPkgNoOpNotInstalled;
- QPixmap iIconPkgNoOpInstalledUpgradeable;
+ ListItemDelegate(const ListItemDelegate& old);
+ ListItemDelegate operator= (const ListItemDelegate& old);
+
+ QPixmap iDefaultIcon;
+ QPixmap iIconPkgInstall;
+ QPixmap iIconPkgUpgrade;
+ QPixmap iIconPkgRemove;
+ QPixmap iIconPkgNoOpInstalled;
+ QPixmap iIconPkgNoOpNotInstalled;
+ QPixmap iIconPkgNoOpInstalledUpgradeable;
};
public:
- enum sortOrder { SortAlpha, SortDateDesc, SortSizeDesc };
-
- explicit PackageView(QWidget *parent);
- virtual ~PackageView();
-
- void openWin();
- void resizeEvent(QResizeEvent* event);
- void setAptInterface(AAptInterface* a_) { iAptInterface=a_; }
- void setSettings(Settings* s_) { iSettings=s_; }
- dimmer* mydimmer() { return iDimmer; }
- void disableMenu();
- void enableMenu();
- void setStatFilter(Package::packageStatus f_);
- void setSortOrder(sortOrder s_) { iSortOrder = s_; }
- void clearSelections();
- void setSearchText(QString text);
- void setSearchOptions(bool pkgname, bool dispname, bool dshort, bool dlong);
-
-#ifdef Q_WS_MAEMO_5 // workaround for buggy Qt autorotation
- void show() {
- if( !isVisible() ) {
- /*
- QRect r = dynamic_cast<QMainWindow*>(this->parent())->rect();
- if(r.width() < r.height()) {
- this->setAttribute(Qt::WA_Maemo5PortraitOrientation);
- }
- else {
- if( dynamic_cast<QMainWindow*>(this->parent())->testAttribute( Qt::WA_Maemo5AutoOrientation ) ) {
- this->setAttribute( Qt::WA_Maemo5AutoOrientation );
- } else {
- this->setAttribute( Qt::WA_Maemo5LandscapeOrientation );
- }
- this->setAttribute(Qt::WA_Maemo5StackedWindow);
- this->setWindowFlags( Qt::Window );
- }
- */
- this->setAttribute(Qt::WA_Maemo5StackedWindow);
- this->setWindowFlags( Qt::Window );
- }
- QMainWindow::show();
- }
+ enum sortOrder { SortAlpha, SortDateDesc, SortSizeDesc };
+
+ explicit PackageView(QWidget *parent);
+ virtual ~PackageView();
+
+ void openWin();
+ void resizeEvent(QResizeEvent* event);
+ void setAptInterface(AAptInterface* a_) { iAptInterface=a_; }
+ void setSettings(Settings* s_) { iSettings=s_; }
+ dimmer* mydimmer() { return iDimmer; }
+ void disableMenu();
+ void enableMenu();
+ void setStatFilter(Package::packageStatus f_);
+ void setSortOrder(sortOrder s_) { iSortOrder = s_; }
+ void clearSelections();
+ void setSearchText(QString text);
+ void setSearchOptions(bool pkgname, bool dispname, bool dshort, bool dlong);
+
+ void show() {
+ if( !isVisible() ) {
+#ifdef Q_WS_MAEMO_5
+ if( dynamic_cast<QMainWindow*>(this->parent())->testAttribute( Qt::WA_Maemo5AutoOrientation ) ) {
+ this->setAttribute( Qt::WA_Maemo5AutoOrientation );
+ } else {
+ this->setAttribute( Qt::WA_Maemo5LandscapeOrientation );
+ }
+ this->setAttribute(Qt::WA_Maemo5StackedWindow);
+ this->setWindowFlags( Qt::Window );
#endif
+ }
+ QMainWindow::show();
+ }
- static const int CatFilterAllMarked = 0;
- static const int CatFilterAllUser = 1;
- static const int CatFilterBlacklisted = 16;
+ static const int CatFilterAllMarked = 0;
+ static const int CatFilterAllUser = 1;
+ static const int CatFilterBlacklisted = 16;
public slots:
- void orientationChanged();
- void on_actionSearch_triggered();
+ void orientationChanged();
+ void on_actionSearch_triggered();
protected:
void changeEvent(QEvent *e);
- AAptInterface* iAptInterface;
- //MainWindow::operation iOperation;
- void closeEvent(QCloseEvent *event);
+ AAptInterface* iAptInterface;
+ //MainWindow::operation iOperation;
+ void closeEvent(QCloseEvent *event);
private:
- PackageView(const PackageView& old);
- PackageView operator= (const PackageView& old);
+ PackageView(const PackageView& old);
+ PackageView operator= (const PackageView& old);
- bool doFilterCategory(Package* pkg);
- QString generateSortString(Package* pkg);
- void addListItem(Package* pkg_, QString listname_);
- void updateLabel(void);
- void resetWindow();
- void clearSearch();
+ bool doFilterCategory(Package* pkg);
+ QString generateSortString(Package* pkg);
+ void addListItem(Package* pkg_, QString listname_);
+ void updateLabel(void);
+ void resetWindow();
+ void clearSearch();
Ui::PackageView *ui;
- MainWindow* iMainWindow;
- QBoxLayout* iPkgLayout;
- dimmer* iDimmer;
- QLabel* iListCoverLabel;
- Settings* iSettings;
+ MainWindow* iMainWindow;
+ QBoxLayout* iPkgLayout;
+ dimmer* iDimmer;
+ QLabel* iListCoverLabel;
+ Settings* iSettings;
- QStringList iCatFilterLabels;
- QStringList iCatFilterStrings;
- int iSelectedCatFilter;
- int iDefaultCatFilter;
+ QStringList iCatFilterLabels;
+ QStringList iCatFilterStrings;
+ int iSelectedCatFilter;
+ int iDefaultCatFilter;
- QStringList iStatFilterLabels;
- int iSelectedStatFilter;
- sortOrder iSortOrder;
- bool iSortNoticeShown;
+ QStringList iStatFilterLabels;
+ int iSelectedStatFilter;
+ sortOrder iSortOrder;
+ bool iSortNoticeShown;
- QList<Package*> iSearchResults;
- QString iPrevSearchText;
- KeyEventGrabber* iKeyFilter;
+ QList<Package*> iSearchResults;
+ QString iPrevSearchText;
+ KeyEventGrabber* iKeyFilter;
- bool iSearchPkgName;
- bool iSearchDisplayName;
- bool iSearchDescShort;
- bool iSearchDescLong;
+ bool iSearchPkgName;
+ bool iSearchDisplayName;
+ bool iSearchDescShort;
+ bool iSearchDescLong;
- int iPackagesEmptySort;
+ int iPackagesEmptySort;
private slots:
- void on_pushButton_searchOptions_clicked();
+ void on_actionStore_list_triggered();
+ void on_pushButton_searchOptions_clicked();
void on_actionRestore_all_triggered();
void on_actionSave_selections_triggered();
- void on_actionLoad_selections_triggered();
- void on_btn_Sort_clicked();
- void on_actionView_log_triggered();
- void on_actionUpgrade_all_triggered();
- void on_lineEdit_textEdited(QString );
- void on_btn_searchClose_clicked();
- void on_actionHelp_triggered();
- void on_btn_StatusFilter_clicked();
- void on_btn_CategoryFilter_clicked();
- void on_listWidget_itemClicked(QListWidgetItem* item);
- void on_actionClear_selections_triggered();
- void on_btn_Commit_clicked();
+ void on_actionLoad_selections_triggered();
+ void on_btn_Sort_clicked();
+ void on_actionView_log_triggered();
+ void on_actionUpgrade_all_triggered();
+ void on_lineEdit_textEdited(QString );
+ void on_btn_searchClose_clicked();
+ void on_actionHelp_triggered();
+ void on_btn_StatusFilter_clicked();
+ void on_btn_CategoryFilter_clicked();
+ void on_listWidget_itemClicked(QListWidgetItem* item);
+ void on_actionClear_selections_triggered();
+ void on_btn_Commit_clicked();
};
class KeyEventGrabber : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
- KeyEventGrabber(QObject* parent = 0);
+ KeyEventGrabber(QObject* parent = 0);
protected:
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event);
};