~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/dlnaexport/plugin_dlnaexport.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of kipi-plugins project
 
4
 * http://www.digikam.org
 
5
 *
 
6
 * Date        : 2012-05-28
 
7
 * Description : A KIPI plugin to export with DLNA Technology
 
8
 *
 
9
 * Copyright (C) 2012 by Smit Mehta <smit dot meh at gmail dot com>
 
10
 *
 
11
 * This program is free software; you can redistribute it
 
12
 * and/or modify it under the terms of the GNU General
 
13
 * Public License as published by the Free Software Foundation;
 
14
 * either version 2, or (at your option) any later version.
 
15
 * 
 
16
 * This program is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * GNU General Public License for more details.
 
20
 *
 
21
 * ============================================================ */
 
22
 
 
23
#include "plugin_dlnaexport.moc"
 
24
 
 
25
extern "C"
 
26
{
 
27
#include <unistd.h>
 
28
}
 
29
 
 
30
// KDE includes
 
31
 
 
32
#include <kaction.h>
 
33
#include <klibloader.h>
 
34
#include <kdebug.h>
 
35
#include <klocalizedstring.h>
 
36
#include <kshortcut.h>
 
37
#include <kactioncollection.h>
 
38
#include <kstandarddirs.h>
 
39
#include <kwindowsystem.h>
 
40
#include <kapplication.h>
 
41
 
 
42
// Libkipi includes
 
43
 
 
44
#include <libkipi/interface.h>
 
45
 
 
46
// Local includes
 
47
 
 
48
#include "wizard.h"
 
49
 
 
50
namespace KIPIDLNAExportPlugin
 
51
{
 
52
 
 
53
K_PLUGIN_FACTORY(DLNAExportFactory, registerPlugin<Plugin_DLNAExport>();)
 
54
K_EXPORT_PLUGIN(DLNAExportFactory("kipiplugin_dlnaexport") )
 
55
 
 
56
class Plugin_DLNAExport::Private
 
57
{
 
58
public:
 
59
 
 
60
    Private()
 
61
    {
 
62
        actionExport = 0;
 
63
        dlgExport    = 0;
 
64
    }
 
65
 
 
66
    KAction* actionExport;
 
67
    Wizard*  dlgExport;
 
68
};
 
69
 
 
70
Plugin_DLNAExport::Plugin_DLNAExport(QObject* const parent, const QVariantList&)
 
71
    : Plugin(DLNAExportFactory::componentData(), parent, "DLNAExport"),
 
72
      d(new Private)
 
73
{
 
74
    kDebug(AREA_CODE_LOADING) << "Plugin_DLNAExport plugin loaded";
 
75
 
 
76
    setUiBaseName("kipiplugin_dlnaexportui.rc");
 
77
    setupXML();
 
78
}
 
79
 
 
80
Plugin_DLNAExport::~Plugin_DLNAExport()
 
81
{
 
82
    delete d;
 
83
}
 
84
 
 
85
void Plugin_DLNAExport::setup(QWidget* const widget)
 
86
{
 
87
    Plugin::setup(widget);
 
88
 
 
89
    if (!interface())
 
90
    {
 
91
        kError() << "KIPI interface is null!";
 
92
        return;
 
93
    }
 
94
 
 
95
    KIconLoader::global()->addAppDir("kipiplugin_dlnaexport");
 
96
    setupActions();
 
97
}
 
98
 
 
99
void Plugin_DLNAExport::setupActions()
 
100
{
 
101
    setDefaultCategory(ExportPlugin);
 
102
 
 
103
    d->actionExport = new KAction(this);
 
104
    d->actionExport->setText(i18n("Export via &DLNA"));
 
105
    d->actionExport->setIcon(KIcon("dlna"));
 
106
 
 
107
    connect(d->actionExport, SIGNAL(triggered(bool)),
 
108
            this, SLOT(slotExport()));
 
109
 
 
110
    addAction("dlnaexport", d->actionExport);
 
111
}
 
112
 
 
113
void Plugin_DLNAExport::slotExport()
 
114
{
 
115
    if (!d->dlgExport)
 
116
    {
 
117
        // We clean it up in the close button
 
118
        d->dlgExport = new Wizard(kapp->activeWindow());
 
119
    }
 
120
    else
 
121
    {
 
122
        if (d->dlgExport->isMinimized())
 
123
        {
 
124
            KWindowSystem::unminimizeWindow(d->dlgExport->winId());
 
125
        }
 
126
 
 
127
        KWindowSystem::activateWindow(d->dlgExport->winId());
 
128
    }
 
129
 
 
130
    d->dlgExport->show();
 
131
}
 
132
 
 
133
}  // namespace KIPIDLNAExportPlugin