~ubuntu-branches/ubuntu/vivid/muon/vivid-proposed

« back to all changes in this revision

Viewing changes to installer/ApplicationLauncher.cpp

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark
  • Date: 2015-03-24 07:36:31 UTC
  • mto: This revision was merged to the branch mainline in revision 86.
  • Revision ID: package-import@ubuntu.com-20150324073631-7nmay5episnfkdlt
Tags: upstream-5.2.2
Import upstream version 5.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright © 2010 by Daniel Nicoletti <dantti85-pk@yahoo.com.br>       *
3
 
 *   Copyright © 2010-2012 Jonathan Thomas <echidnaman@kubuntu.org>        *
4
 
 *                                                                         *
5
 
 *   This program is free software; you can redistribute it and/or modify  *
6
 
 *   it under the terms of the GNU General Public License as published by  *
7
 
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 
 *   (at your option) any later version.                                   *
9
 
 *                                                                         *
10
 
 *   This program is distributed in the hope that it will be useful,       *
11
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 
 *   GNU General Public License for more details.                          *
14
 
 *                                                                         *
15
 
 *   You should have received a copy of the GNU General Public License     *
16
 
 *   along with this program; see the file COPYING. If not, write to       *
17
 
 *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  *
18
 
 *   Boston, MA 02110-1301, USA.                                           *
19
 
 ***************************************************************************/
20
 
 
21
 
#include "ApplicationLauncher.h"
22
 
 
23
 
#include "LaunchListModel.h"
24
 
 
25
 
#include <QtCore/QStringBuilder>
26
 
#include <QtWidgets/QLabel>
27
 
#include <QListView>
28
 
#include <QtWidgets/QPushButton>
29
 
#include <QStandardItemModel>
30
 
#include <QtWidgets/QVBoxLayout>
31
 
 
32
 
#include <KLocalizedString>
33
 
#include <KStandardGuiItem>
34
 
 
35
 
ApplicationLauncher::ApplicationLauncher(LaunchListModel* model, QWidget* parent)
36
 
    : QDialog(parent)
37
 
    , m_model(model)
38
 
{
39
 
    QVBoxLayout *layout = new QVBoxLayout(this);
40
 
    setLayout(layout);
41
 
 
42
 
    QLabel *label = new QLabel(this);
43
 
    label->setText(i18np("The following application was just installed, click on it to launch:",
44
 
                         "The following applications were just installed, click on them to launch:",
45
 
                         model->rowCount()));
46
 
 
47
 
    QListView *appView = new QListView(this);
48
 
    appView->setIconSize(QSize(32, 32));
49
 
    connect(appView, SIGNAL(activated(QModelIndex)),
50
 
            m_model, SLOT(invokeApplication(QModelIndex)));
51
 
 
52
 
    QWidget *bottomBox = new QWidget(this);
53
 
    QHBoxLayout *bottomLayout = new QHBoxLayout(bottomBox);
54
 
    bottomLayout->setSpacing(0);
55
 
    bottomLayout->setMargin(0);
56
 
    bottomBox->setLayout(bottomLayout);
57
 
 
58
 
    QWidget *bottomSpacer = new QWidget(bottomBox);
59
 
    bottomSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
60
 
 
61
 
    QPushButton *closeButton = new QPushButton(bottomBox);
62
 
    KGuiItem closeItem = KStandardGuiItem::close();
63
 
    closeButton->setText(closeItem.text());
64
 
    closeButton->setIcon(closeItem.icon());
65
 
    connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()));
66
 
 
67
 
    bottomLayout->addWidget(bottomSpacer);
68
 
    bottomLayout->addWidget(closeButton);
69
 
 
70
 
    appView->setModel(m_model);
71
 
 
72
 
    layout->addWidget(label);
73
 
    layout->addWidget(appView);
74
 
    layout->addWidget(bottomBox);
75
 
}