source: src-qt4/pc-softwaremanager/largeItemWidget.h @ 78fa8b2

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 78fa8b2 was 78fa8b2, checked in by Ken Moore <ken@…>, 20 months ago

Merge the new AppCafe? into the src-qt4 tree from the projects directory

  • Property mode set to 100644
File size: 3.1 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      QGridLayout *layout = new QGridLayout;
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      layout->addWidget(button,0,0,2,1);
65      layout->addWidget(appName,0,1);
66      layout->addWidget(appDesc,1,1);
67      this->setLayout(layout);
68      //Save the app identifier
69      uniqueAppID=appID;
70      connect(button,SIGNAL(triggered(QAction*)), this, SLOT(sendSignal()) );
71    }
72    virtual ~LargeItemWidget(){}
73 
74         
75};
76
77#endif
Note: See TracBrowser for help on using the repository browser.