source: src-qt4/pc-softwaremanager/largeItemWidget.h @ 868c95d

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since 868c95d was 868c95d, checked in by Kris Moore <kris@…>, 14 months ago

Fix a bug where the Upgrade status keeps just showing the last bit of a download,
especially when we may be 4 minutes into the actual extraction part of the update ;)

Fix a compiler warning

Rename Upgrade -> Update to be consistent

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/***************************************************************************
2 *   Copyright (C) 2011 - iXsystems                                       *
3 *   kris@pcbsd.org  *
4 *   tim@pcbsd.org   *
5 *   ken@pcbsd.org   *
6 *                                                                         *
7 *   Permission is hereby granted, free of charge, to any person obtaining *
8 *   a copy of this software and associated documentation files (the       *
9 *   "Software"), to deal in the Software without restriction, including   *
10 *   without limitation the rights to use, copy, modify, merge, publish,   *
11 *   distribute, sublicense, and/or sell copies of the Software, and to    *
12 *   permit persons to whom the Software is furnished to do so, subject to *
13 *   the following conditions:                                             *
14 *                                                                         *
15 *   The above copyright notice and this permission notice shall be        *
16 *   included in all copies or substantial portions of the Software.       *
17 *                                                                         *
18 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
19 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
20 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
21 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
22 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
23 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
24 *   OTHER DEALINGS IN THE SOFTWARE.                                       *
25 ***************************************************************************/
26#ifndef _APPCAFE_LARGE_WIDGET_H
27#define _APPCAFE_LARGE_WIDGET_H
28
29#include <QWidget>
30#include <QToolButton>
31#include <QLabel>
32#include <QGridLayout>
33#include <QAction>
34#include <QString>
35#include <QIcon>
36
37class LargeItemWidget : public QWidget{
38        Q_OBJECT
39       
40  private:
41    QString uniqueAppID; //should be something unique like <name>-<version>-<arch>     
42   
43  signals:
44    void appClicked(QString);
45   
46  private slots:
47    void sendSignal(){ emit appClicked(uniqueAppID); }
48   
49  public:
50    LargeItemWidget(QString appID, QString name, QString description, QString icon) : QWidget(){
51
52      //Create the toolbutton
53      QToolButton *button = new QToolButton();
54        button->setIconSize(QSize(34,34));
55          QAction *act = new QAction( QIcon(icon), "", 0);
56        button->setDefaultAction(act);
57        button->setToolButtonStyle(Qt::ToolButtonIconOnly);
58
59      //Create the labels
60      QLabel *appName = new QLabel("<b>"+name+"</b>");
61      QLabel *appDesc = new QLabel(description);
62        appDesc->setWordWrap(TRUE);
63      //Add the items to the widget
64      QGridLayout *layout = new QGridLayout;
65      layout->addWidget(button,0,0,2,1);
66      layout->addWidget(appName,0,1);
67      layout->addWidget(appDesc,1,1);
68      this->setLayout(layout);
69     
70      //Save the app identifier
71      uniqueAppID=appID;
72      connect(button,SIGNAL(clicked()), this, SLOT(sendSignal()) );
73    }
74    virtual ~LargeItemWidget(){}
75   
76  protected:
77    void mousePressEvent(QMouseEvent *ev){ Q_UNUSED(ev); sendSignal(); } 
78 
79         
80};
81
82#endif
Note: See TracBrowser for help on using the repository browser.