Commit a8d2ff6c authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Remove dead plasma code

This has not been ported to KF5 after all those years.
If sb. wants to revive the code it can still be recovered from the git history.
parent 84c96f7d
Pipeline #120148 passed with stage
in 2 minutes and 24 seconds
......@@ -145,7 +145,6 @@ add_subdirectory(ui)
add_subdirectory(transfer-plugins)
add_subdirectory(sounds)
add_subdirectory(desktop)
#add_subdirectory(plasma) TODO PORT TO KF5/QML
add_subdirectory(tests)
add_subdirectory(doc)
......
add_subdirectory(applet)
add_subdirectory(engine)
add_subdirectory(runner)
set(kgetcommonapplet_SRCS
common/kgetappletutils.cpp
common/kgetapplet.cpp
)
qt4_add_dbus_interface(kgetcommonapplet_SRCS ../../dbus/org.kde.kget.transfer.xml transfer_interface)
set(kgetbarapplet_SRCS
barapplet/kgetbarapplet.cpp
${kgetcommonapplet_SRCS}
)
qt4_add_dbus_interface(kgetbarapplet_SRCS ../../dbus/org.kde.kget.main.xml kget_interface)
kde4_add_plugin(plasma_kget_barapplet ${kgetbarapplet_SRCS})
target_link_libraries(plasma_kget_barapplet ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS})
install(TARGETS plasma_kget_barapplet DESTINATION ${KDE_INSTALL_PLUGINDIR})
#set(kgetpanelbar_SRCS
# panelbar/kgetpanelbar.cpp
# ${kgetcommonapplet_SRCS}
#)
#
#qt4_add_dbus_interface(kgetpanelbar_SRCS ../../../kget/dbus/org.kde.kget.main.xml kget_interface)
#
#kde4_add_plugin(plasma_kget_panelbar ${kgetpanelbar_SRCS})
#target_link_libraries(plasma_kget_panelbar ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
#
#install(TARGETS plasma_kget_panelbar DESTINATION ${KDE_INSTALL_PLUGINDIR})
set(kgetpiechart_SRCS
piechart/kgetpiechart.cpp
${kgetcommonapplet_SRCS}
)
qt4_add_dbus_interface(kgetpiechart_SRCS ../../dbus/org.kde.kget.main.xml kget_interface)
kde4_add_plugin(plasma_kget_piechart ${kgetpiechart_SRCS})
target_link_libraries(plasma_kget_piechart ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS})
install(TARGETS plasma_kget_piechart DESTINATION ${KDE_INSTALL_PLUGINDIR})
install(FILES barapplet/kgetbarapplet-default.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
#install(FILES panelbar/kgetpanelbarapplet-default.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install(FILES piechart/kgetpiechartapplet-default.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
#! /usr/bin/env bash
$XGETTEXT */*.cpp -o $podir/plasma_applet_kget.pot
[Desktop Entry]
Encoding=UTF-8
Name=KGet Barchart Applet
Name[bs]=Trakasti grafikon KGeta
Name[ca]=Miniaplicació de diagrama de barres del KGet
Name[ca@valencia]=Miniaplicació de diagrama de barres del KGet
Name[cs]=Applet pro sloupcový graf v KGet
Name[da]=KGet søjlediagram-applet
Name[de]=KGet Balkengrafik-Modul
Name[el]=Μικροεφαρμογή ραβδογραφήματος KGet
Name[en_GB]=KGet Barchart Applet
Name[es]=Miniaplicación de gráfica de barras de KGet
Name[et]=KGeti tulpdiagrammi aplett
Name[eu]=KGet-eko barra-diagramen miniaplikazioa
Name[fi]=KGetin pylväskaaviosovelma
Name[fr]=Composant graphique d'histogramme pour KGet
Name[ga]=Feidhmchláirín barrachairte KGet
Name[gl]=Miniaplicativo de diagrama de barras de KGet
Name[hr]=Applet za stupčasti dijagram za KGet
Name[hu]=KGet oszlopdiagram
Name[ia]=Applet Barchart de KGet (carta a barras)
Name[id]=Barchart Applet KGet
Name[it]=Grafici a barre per KGet
Name[ja]=KGet 棒グラフアプレット
Name[kk]=KGet гистограмма апплеті
Name[km]=អាប់ភ្លេត​គំនូស​តាង​របស់ KGet
Name[ko]=KGet 막대 그래프 애플릿
Name[lt]=KGet stulpelinės diagramos programėlė
Name[lv]=KGet stabiņu tabulas sīkrīks
Name[nb]=Miniprogram for KGet-stolpediagram
Name[nds]=KGet-Balkengrafik-Lüttprogramm
Name[nl]=Balkgrafiekapplet voor KGet
Name[nn]=KGet-søylediagram
Name[pa]=ਕੇ-ਗਿੱਟ ਬਾਰਚਾਰਟ ਐਪਲਿਟ
Name[pl]=Wykres słupkowy w KGet
Name[pt]='Applet' de Gráfico de Barras do KGet
Name[pt_BR]=Miniaplicativo de gráfico de barras do KGet
Name[ro]=Miniaplicație KGet DiagramăBară
Name[ru]=KGet: ход загрузки
Name[si]=KGet තීරු ප්‍රස්ථාර යෙදුම
Name[sk]=Stĺpcový graf pre KGet
Name[sl]=KGet (stolpični graf)
Name[sr]=тракасти графикон К‑гета
Name[sr@ijekavian]=тракасти графикон К‑гета
Name[sr@ijekavianlatin]=trakasti grafikon KGeta
Name[sr@latin]=trakasti grafikon KGeta
Name[sv]=Stapeldiagram-miniprogram för Kget
Name[tr]=KGet Sütun Grafiği Programcığı
Name[ug]=KGet بالداق دىئاگرامما ئەپچە
Name[uk]=Аплет гістограми KGet
Name[x-test]=xxKGet Barchart Appletxx
Name[zh_CN]=KGet 条形图小部件
Name[zh_TW]=KGet 圖表小程式
Comment=KGet barchart applet
Comment[ar]=بريمج KGet عمود خُطاطة
Comment[bs]=Aplet trakastog grafikona za KGet
Comment[ca]=Miniaplicació de diagrama de barres del KGet
Comment[ca@valencia]=Miniaplicació de diagrama de barres del KGet
Comment[cs]=Applet pro sloupcový graf v KGet
Comment[da]=KGet søjlediagram-applet
Comment[de]=KGet Balkengrafik-Modul
Comment[el]=Μικροεφαρμογή ραβδογραφήματος KGet
Comment[en_GB]=KGet barchart applet
Comment[es]=Miniaplicación de gráfica de barras de KGet
Comment[et]=KGeti tulpdiagrammi aplett
Comment[eu]=KGet-eko barra-diagramen miniaplikazioa
Comment[fi]=KGetin pylväskaaviosovelma
Comment[fr]=Composant graphique d'histogramme pour KGet
Comment[ga]=Feidhmchláirín barrachairte KGet
Comment[gl]=Miniaplicativo de diagrama de barras de KGet
Comment[hne]=केगेट बारचार्ट ऐप्लेट
Comment[hr]=Applet za stupčasti dijagram za KGet
Comment[hu]=KGet oszlopdiagram
Comment[ia]=Applet Barchart de KGet (carta a barras)
Comment[id]=Barchart applet dari KGet
Comment[it]=Grafici a barre per KGet
Comment[ja]=KGet 棒グラフアプレット
Comment[kk]=KGet гистограммасының апплеті
Comment[km]=អាប់ភ្លេត​គំនូស​តាង​របារ​របស់ KGet
Comment[ko]=KGet 막대 그래프 애플릿
Comment[lt]=KGet stulpelinės diagramos programėlė
Comment[lv]=KGet stabiņu tabulas sīkrīks
Comment[ml]=കെഗെറ്റ് ബാര്‍ചാര്‍ട്ട് എന്ന ലഘുപ്രയോഗം
Comment[nb]=Miniprogram for KGet-stolpediagram
Comment[nds]=Balkengrafik-Lüttprogramm för KGet
Comment[nl]=Balkgrafiekapplet voor KGet
Comment[nn]=KGet-søylediagram
Comment[pa]=ਕੇ-ਗਿੱਟ ਬਾਰਚਾਰਟ ਐਪਲਿਟ
Comment[pl]=Aplet KGet pokazujący wykres słupkowy
Comment[pt]='Applet' de gráfico de barras do KGet
Comment[pt_BR]=Miniaplicativo de gráfico de barras do KGet
Comment[ro]=Miniaplicație KGet DiagramăBară
Comment[ru]=Показывает загрузки KGet в линейных диаграммах
Comment[si]=KGet තීරු ප්‍රස්ථාර යෙදුම
Comment[sk]=Stĺpcový graf pre KGet
Comment[sl]=Stolpični graf za KGet
Comment[sq]=KGet barchart applet
Comment[sr]=Аплет тракастог графикона за К‑гет
Comment[sr@ijekavian]=Аплет тракастог графикона за К‑гет
Comment[sr@ijekavianlatin]=Aplet trakastog grafikona za KGet
Comment[sr@latin]=Aplet trakastog grafikona za KGet
Comment[sv]=Stapeldiagram-miniprogram för Kget
Comment[tr]=KGet sütun grafiği programcığı
Comment[ug]=KGet بالداق دىئاگرامما ئەپچە
Comment[uk]=Аплет гістограми KGet
Comment[x-test]=xxKGet barchart appletxx
Comment[zh_CN]=KGet 条形图小部件
Comment[zh_TW]=KGet 圖表小程式
Icon=kget
Type=Service
ServiceTypes=Plasma/Applet
X-KDE-Library=plasma_kget_barapplet
X-KDE-PluginInfo-Author=Javier Goday
X-KDE-PluginInfo-Email=
X-KDE-PluginInfo-Name=barapplet
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=https://kde.org/plasma-desktop
X-KDE-PluginInfo-Category=Online Services
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* Copyright (C) 2007 by Javier Goday <jgoday@gmail.com> *
* Copyright (C) 2009 by Matthias Fuchs <mat69@gmx.net> *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "barapplet/kgetbarapplet.h"
#include "barapplet/kgetbarapplet_p.h"
#include "../../../core/transferhandler.h"
#include <QProgressBar>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QDebug>
#include <Plasma/ScrollWidget>
KGetBarApplet::Private::Private(QGraphicsWidget *parent)
: QGraphicsWidget(parent)
{
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, this);
m_scrollWidget = new Plasma::ScrollWidget();
m_containerWidget = new QGraphicsWidget(m_scrollWidget);
m_scrollWidget->setWidget(m_containerWidget);
m_containerLayout = new QGraphicsLinearLayout(Qt::Vertical, m_containerWidget);
layout->addItem(m_scrollWidget);
setLayout(layout);
}
KGetBarApplet::Private::~Private()
{
}
void KGetBarApplet::Private::addTransfers(const QList<OrgKdeKgetTransferInterface*> &transfers)
{
foreach (OrgKdeKgetTransferInterface *transfer, transfers) {
if (m_items.contains(transfer)) {
continue;
}
connect(transfer, SIGNAL(transferChangedEvent(int)), this, SLOT(slotUpdateTransfer(int)));
QString fileName = KUrl(transfer->dest().value()).fileName();
qDebug() << fileName;
Item *item = new Item;
item->proxy = new QGraphicsProxyWidget();
item->progressBar = new QProgressBar();
item->proxy->setWidget(item->progressBar);
item->progressBar->setFormat(fileName + " %v%");
m_items[transfer] = item;
//running downloads are prepended, others appended
if (transfer->percent() == 100) {
m_containerLayout->addItem(item->proxy);
} else {
m_containerLayout->insertItem(0, item->proxy);
}
item->progressBar->setValue(transfer->percent().value());
}
}
void KGetBarApplet::Private::removeTransfers(const QList<OrgKdeKgetTransferInterface*> &transfers)
{
// remove the progressbars for the deleted transfers
QHash<OrgKdeKgetTransferInterface*, Item*>::iterator it;
QHash<OrgKdeKgetTransferInterface*, Item*>::iterator itEnd = m_items.end();
for (it = m_items.begin(); it != itEnd; ) {
OrgKdeKgetTransferInterface *transfer = it.key();
if (transfers.contains(transfer)) {
Item *item = it.value();
it = m_items.erase(it);
m_containerLayout->removeItem(item->proxy);
item->proxy->deleteLater();
item->progressBar->deleteLater();
delete item;
} else {
++it;
}
}
}
void KGetBarApplet::Private::slotUpdateTransfer(int transferChange)
{
OrgKdeKgetTransferInterface *transfer = qobject_cast<OrgKdeKgetTransferInterface*>(QObject::sender());
if (transfer && m_items.contains(transfer)) {
Item *item = m_items[transfer];
if (transferChange & Transfer::Tc_Percent) {
item->progressBar->setValue(transfer->percent());
}
if (transferChange & Transfer::Tc_FileName) {
const QString fileName = KUrl(transfer->dest().value()).fileName();
item->progressBar->setFormat(fileName + " %v%");
item->progressBar->setValue(transfer->percent());
}
}
}
KGetBarApplet::KGetBarApplet(QObject *parent, const QVariantList &args)
: KGetApplet(parent, args)
{
}
KGetBarApplet::~KGetBarApplet()
{
}
void KGetBarApplet::init()
{
d = new KGetBarApplet::Private(this);
setDataWidget(d);
connect(this, SIGNAL(transfersAdded(QList<OrgKdeKgetTransferInterface*>)), d, SLOT(addTransfers(QList<OrgKdeKgetTransferInterface*>)));
connect(this, SIGNAL(transfersRemoved(QList<OrgKdeKgetTransferInterface*>)), d, SLOT(removeTransfers(QList<OrgKdeKgetTransferInterface*>)));
KGetApplet::init();
}
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
*
* Copyright (C) 2007 by Javier Goday <jgoday@gmail.com>
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef KGETBARAPPLET_H
#define KGETBARAPPLET_H
#include "common/kgetapplet.h"
#include <plasma/dataengine.h>
namespace Plasma {
class Svg;
}
class QGraphicsProxyWidget;
class QGraphicsLinearLayout;
class KGetBarApplet : public KGetApplet
{
Q_OBJECT
public:
KGetBarApplet(QObject *parent, const QVariantList &args);
~KGetBarApplet() override;
void init();
private:
class Private;
Private *d;
};
K_EXPORT_PLASMA_APPLET(barapplet, KGetBarApplet)
#endif
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* Copyright (C) 2007 by Javier Goday <jgoday@gmail.com> *
* Copyright (C) 2009 by Matthias Fuchs <mat69@gmx.net> *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef KGETBARAPPLET_P_H
#define KGETBARAPPLET_P_H
#include <QGraphicsWidget>
#include <QHash>
namespace Plasma
{
class ScrollWidget;
}
class QGraphicsProxyWidget;
class QProgressBar;
class KGetBarApplet::Private : public QGraphicsWidget
{
Q_OBJECT
public:
explicit Private(QGraphicsWidget *parent = nullptr);
~Private() override;
public Q_SLOTS:
void addTransfers(const QList<OrgKdeKgetTransferInterface*> &transfers);
void removeTransfers(const QList<OrgKdeKgetTransferInterface*> &transfers);
private Q_SLOTS:
void slotUpdateTransfer(int transferChange);
private:
struct Item
{
QGraphicsProxyWidget *proxy;
QProgressBar *progressBar;
};
Plasma::ScrollWidget *m_scrollWidget;
QGraphicsWidget *m_containerWidget;
QGraphicsLinearLayout *m_containerLayout;
QHash<OrgKdeKgetTransferInterface*, Item*> m_items;
};
#endif
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
*
* Copyright (C) 2008 - 2009 by Lukas Appelhans <l.appelhans@gmx.de>
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "kgetapplet.h"
#include "kget_interface.h"
#include "kgetappletutils.h"
#include "../../../core/transferhandler.h"
#include <plasma/dataengine.h>
#include <plasma/theme.h>
#include <plasma/widgets/iconwidget.h>
#include <plasma/widgets/meter.h>
#include <QGraphicsSceneDragDropEvent>
#include <QGraphicsLinearLayout>
#include <QDropEvent>
#include <QStyleOptionGraphicsItem>
#include <QProgressBar>
#include <QGraphicsProxyWidget>
#include <QPainter>
#include <QDBusConnectionInterface>
#include <KUrl>
#include <KLocale>
#include <QIcon>
const int ProxyWidget::MARGIN = 20;
const int ProxyWidget::TOP_MARGIN = 55;
const int ProxyWidget::LEFT_MARGIN = 15;
const int ProxyWidget::SPACING = 4;
const QString KGetApplet::KGET_DBUS_SERVICE = "org.kde.kget";
const QString KGetApplet::KGET_DBUS_PATH = "/KGet";
ProxyWidget::ProxyWidget(QGraphicsWidget * parent)
: QGraphicsWidget(parent),
m_layout(0),
m_dataWidget(0)
{
m_layout = new QGraphicsLinearLayout(Qt::Vertical, this);
m_layout->setSpacing(SPACING);
//m_layout->setContentsMargins(MARGIN, TOP_MARGIN, MARGIN, MARGIN);
themeChanged();
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), SLOT(themeChanged()));
}
ProxyWidget::~ProxyWidget()
{
}
void ProxyWidget::paint(QPainter * p, const QStyleOptionGraphicsItem * option, QWidget * widget)
{
const QRect rect = option->rect;
p->setRenderHint(QPainter::SmoothPixmapTransform);
QFont font = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
font.setBold(true);
font.setPointSize(15);
p->setFont(font);
p->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
QRect iconRect(QPoint(rect.x() + SPACING + 10, rect.y() + SPACING + 10), QSize(m_textHeight, m_textHeight));
QIcon::fromTheme("kget").paint(p, iconRect);
p->drawText(QRectF(rect.x() + SPACING * 2 + 10 + iconRect.width(), rect.y() + SPACING + 10,
m_textWidth, m_textHeight), i18n("KGet"));
p->drawLine(QPointF(rect.x() + SPACING + 10, rect.y() + SPACING * 2 + 10 + m_textHeight),
QPointF(rect.width() - SPACING - 10, rect.y() + SPACING * 2 + 10 + m_textHeight));
QGraphicsWidget::paint(p, option, widget);
}
void ProxyWidget::themeChanged()
{
QFont font = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
font.setBold(true);
font.setPointSize(15);
QFontMetrics metrics(font);
m_textWidth = metrics.width(i18n("KGet"));
m_textHeight = metrics.height();
m_layout->setContentsMargins(MARGIN, MARGIN + m_textHeight + SPACING + 10, MARGIN, MARGIN);
}
void ProxyWidget::setDataWidget(QGraphicsWidget *widget)
{
if (m_layout->count())
m_layout->removeAt(0);
m_layout->addItem(widget);
m_dataWidget = widget;
}
QGraphicsWidget *ProxyWidget::dataWidget()
{
return m_dataWidget;
}
KGetApplet::KGetApplet(QObject *parent, const QVariantList &args)
: Plasma::PopupApplet(parent, args),
m_proxyWidget(0),
m_errorWidget(0),
m_dataWidget(0),
m_globalProgress(0),
m_icon(0),
m_engine(0),
m_totalSize(0),
m_downloadedSize(0)
{
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setBackgroundHints(Applet::DefaultBackground);
setAcceptDrops(true);
m_proxyWidget = new ProxyWidget(this);
}
KGetApplet::~KGetApplet()
{
}
void KGetApplet::init()
{
//KF5 port: remove this line and define TRANSLATION_DOMAIN in CMakeLists.txt instead
//KLocale::global()->insertCatalog("plasma_applet_kget");
setPopupIcon("kget");
m_engine = dataEngine("kget");
if (m_engine) {
m_engine->connectSource("KGet", this);
} else {
qCDebug(KGET_DEBUG) << "KGet Engine could not be loaded";
}
m_globalProgress = new Plasma::Meter(this);
m_globalProgress->setMeterType(Plasma::Meter::BarMeterHorizontal);
m_globalProgress->setMinimumSize(QSize(0, 0));
setGraphicsWidget(m_proxyWidget);
}
void KGetApplet::slotKgetStarted()
{