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

« back to all changes in this revision

Viewing changes to src/upload/videopage.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 "videopage.h"
 
23
 
 
24
// JoschyCore
 
25
#include <joschycore/manager.h>
 
26
#include <joschycore/plugininfo.h>
 
27
#include <joschycore/abstractprovider.h>
 
28
 
 
29
// KDE
 
30
#include <kmessagebox.h>
 
31
#include <kdebug.h>
 
32
 
 
33
// Qt
 
34
#include <QtCore/QFile>
 
35
 
 
36
 
 
37
VideoPage::VideoPage(QWidget *parent)
 
38
    : QWizardPage(parent), m_provider(0)
 
39
{
 
40
 
 
41
    setupUi(this);
 
42
 
 
43
    registerField("Video*", videoRequester, "text", SIGNAL(textChanged(QString)));
 
44
    registerField("Title*", titleEdit);
 
45
    registerField("Description*", descriptionEdit, "plainText", SIGNAL(textChanged()));
 
46
    registerField("Category*", categoryCombo, "currentText", SIGNAL(currentIndexChanged(QString)));
 
47
    registerField("Tags*", tagBox, "items", SIGNAL(changed()));
 
48
 
 
49
    connect(descriptionEdit, SIGNAL(textChanged()), this, SLOT(descriptionChanged()));
 
50
 
 
51
    descriptionEdit->setCheckSpellingEnabled(true);
 
52
 
 
53
}
 
54
 
 
55
 
 
56
VideoPage::~VideoPage()
 
57
{
 
58
 
 
59
    if (m_provider) {
 
60
        Joschy::Manager::self()->unloadProvider(m_provider);
 
61
    }
 
62
 
 
63
}
 
64
 
 
65
 
 
66
void VideoPage::initializePage()
 
67
{
 
68
 
 
69
    if (m_provider) {
 
70
        Joschy::Manager::self()->unloadProvider(m_provider);
 
71
        m_provider = 0;
 
72
    }
 
73
 
 
74
    Joschy::AbstractProvider *plugin = Joschy::Manager::self()->createProvider(field("Provider").toString(),
 
75
                                                                               "QNetworkLayer");
 
76
 
 
77
    if (!plugin) {
 
78
        KMessageBox::error(this, i18n("Cannot load: %1", field("Provider").toString()));
 
79
        return;
 
80
    }
 
81
 
 
82
    m_provider = plugin;
 
83
 
 
84
    categorysChanged(plugin->categorys());
 
85
    connect(m_provider, SIGNAL(categorysChanged(QStringList)), this,
 
86
            SLOT(categorysChanged(QStringList)));
 
87
 
 
88
}
 
89
 
 
90
 
 
91
void VideoPage::categorysChanged(const QStringList &categorys)
 
92
{
 
93
 
 
94
    categoryCombo->clear();
 
95
    categoryCombo->addItems(categorys);
 
96
 
 
97
}
 
98
 
 
99
 
 
100
void VideoPage::descriptionChanged()
 
101
{
 
102
 
 
103
    QString text = descriptionEdit->toPlainText();
 
104
    if (text.length() > 5000) {
 
105
        text.resize(5000);
 
106
        descriptionEdit->setText(text);
 
107
    }
 
108
 
 
109
}
 
110
 
 
111
 
 
112
 
 
113
#include "videopage.moc"