~ubuntu-branches/ubuntu/raring/recorditnow/raring

« back to all changes in this revision

Viewing changes to src/upload/pluginpage.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-09 14:54:01 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110109145401-gyckb4airz4fio50
Tags: 0.8.1-0ubuntu1
* New upstream release. (LP: #681270)
  - Update debian/copyright.
* Build-depend on recordmydesktop.
* Add a watch file.
* Drop 01_fix_ftbfs_kwarning_call.diff, fixed upstream.
* Add 01_joschy_install_to_usr_lib.diff.
* Add 02_fix_ftbfs_no-add-needed.diff.
* Add 03_dont_install_header_files.diff.
* Replace dependency on libpolkit-qt-1-0 with policykit-1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2010 by Kai Dombrowe <just89@gmx.de>                    *
 
3
 *                                                                         *
 
4
 *   This program is free software; you can redistribute it and/or modify  *
 
5
 *   it under the terms of the GNU General Public License as published by  *
 
6
 *   the Free Software Foundation; either version 2 of the License, or     *
 
7
 *   (at your option) any later version.                                   *
 
8
 *                                                                         *
 
9
 *   This program is distributed in the hope that it will be useful,       *
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
 *   GNU General Public License for more details.                          *
 
13
 *                                                                         *
 
14
 *   You should have received a copy of the GNU General Public License     *
 
15
 *   along with this program; if not, write to the                         *
 
16
 *   Free Software Foundation, Inc.,                                       *
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
 
18
 ***************************************************************************/
 
19
 
 
20
 
 
21
// own
 
22
#include "pluginpage.h"
 
23
 
 
24
// JoschyCore
 
25
#include <joschycore/manager.h>
 
26
 
 
27
// KDE
 
28
#include <kicon.h>
 
29
#include <kiconloader.h>
 
30
#include <kdebug.h>
 
31
 
 
32
// Qt
 
33
#include <QtGui/QListWidgetItem>
 
34
 
 
35
 
 
36
Q_DECLARE_METATYPE(Joschy::PluginInfo);
 
37
PluginPage::PluginPage(QWidget *parent)
 
38
    : QWizardPage(parent)
 
39
{
 
40
 
 
41
    setupUi(this);
 
42
 
 
43
    connect(providerList, SIGNAL(currentRowChanged(int)), this, SLOT(currentRowChanged(int)));
 
44
 
 
45
    registerField("Provider*", nameLine);
 
46
 
 
47
}
 
48
 
 
49
 
 
50
Joschy::PluginInfo PluginPage::plugin() const
 
51
{
 
52
 
 
53
    QListWidgetItem *item = providerList->item(providerList->currentRow());
 
54
    Q_ASSERT(item);
 
55
 
 
56
    return item->data(Qt::UserRole+1).value<Joschy::PluginInfo>();
 
57
 
 
58
}
 
59
 
 
60
 
 
61
 
 
62
void PluginPage::initializePage()
 
63
{
 
64
 
 
65
    providerList->clear();
 
66
    foreach (const Joschy::PluginInfo &info, Joschy::Manager::self()->availableProvider()) {
 
67
        QListWidgetItem *item = new QListWidgetItem();
 
68
        item->setText(info.name());
 
69
        item->setIcon(KIcon(info.icon()));
 
70
        item->setData(Qt::UserRole+1, QVariant::fromValue(info));
 
71
 
 
72
        providerList->addItem(item);
 
73
    }
 
74
    providerList->setCurrentRow(0);
 
75
    currentRowChanged(0);
 
76
 
 
77
}
 
78
 
 
79
 
 
80
void PluginPage::currentRowChanged(int currentRow)
 
81
{
 
82
 
 
83
    QListWidgetItem *item = providerList->item(currentRow);
 
84
    if (!item) {
 
85
        return;
 
86
    }
 
87
 
 
88
    const Joschy::PluginInfo info = item->data(Qt::UserRole+1).value<Joschy::PluginInfo>();
 
89
    nameLine->setText(info.name());
 
90
    descriptionLine->setText(info.description());
 
91
    versionLine->setText(info.version());
 
92
 
 
93
    setField("Provider", info.name());
 
94
 
 
95
}
 
96
 
 
97
 
 
98
#include "pluginpage.moc"
 
99
 
 
100
 
 
101
 
 
102
 
 
103
 
 
104
 
 
105
 
 
106