common/kgetapplet.cpp
)
-qt4_add_dbus_interface(kgetcommonapplet_SRCS ../../dbus/org.kde.kget.transfer.xml transfer_interface)
+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)
+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 KDE4::kdeui)
-install(TARGETS plasma_kget_barapplet DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
-
-
-#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 KDE4::kdeui KDE4::kio)
-#
-#install(TARGETS plasma_kget_panelbar DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
+install(
+ TARGETS plasma_kget_barapplet
+ DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
+)
+install(
+ FILES barapplet/kgetbarapplet-default.desktop
+ DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
+)
set(kgetpiechart_SRCS
piechart/kgetpiechart.cpp
${kgetcommonapplet_SRCS}
)
-qt4_add_dbus_interface(kgetpiechart_SRCS ../../dbus/org.kde.kget.main.xml kget_interface)
+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 KDE4::kdeui)
-install(TARGETS plasma_kget_piechart DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
-
-
-install(FILES barapplet/kgetbarapplet-default.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
-#install(FILES panelbar/kgetpanelbarapplet-default.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
-install(FILES piechart/kgetpiechartapplet-default.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
+install(
+ TARGETS plasma_kget_piechart
+ DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
+)
+install(
+ FILES piechart/kgetpiechartapplet-default.desktop
+ DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
+)
+++ /dev/null
-/***************************************************************************
- * *
- * 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 . *
- ***************************************************************************/
-
-#include "panelbar/kgetpanelbar.h"
-#include "panelbar/kgetpanelbar_p.h"
-#include "common/kgetappletutils.h"
-
-#include <QGridLayout>
-#include <QGraphicsProxyWidget>
-#include <QGraphicsLinearLayout>
-#include <QLabel>
-#include <QPainter>
-#include <QProgressBar>
-
-#include <KDebug>
-#include <KIcon>
-#include <KIconLoader>
-#include <KLocale>
-#include <KTitleWidget>
-#include <KWindowSystem>
-#include <kio/global.h>
-
-#include <plasma/applet.h>
-#include <plasma/dataengine.h>
-#include <plasma/dialog.h>
-#include <plasma/svg.h>
-#include <plasma/theme.h>
-#include <plasma/widgets/iconwidget.h>
-
-const static int TOP_MARGIN = 60;
-const static int SPACING = 4;
-const static int MARGIN = 20;
-const static int MAX_DOWNLOADS_PER_PAGE = 5;
-
-KGetPanelBar::Private::Private(QWidget *parent) : Plasma::Dialog(parent),
- m_transfers()
-{
- m_dialogLayout = new QGridLayout(this);
- m_dialogLayout->setColumnStretch(0, 0);
- m_dialogLayout->setColumnStretch(1, 0);
- m_dialogLayout->setColumnStretch(2, 1);
- setLayout(m_dialogLayout);
-
- KTitleWidget *title = new KTitleWidget(this);
- title->setText(i18n("KGet transfers"));
- title->setPixmap(KIcon("kget").pixmap(22, 22), KTitleWidget::ImageRight);
- m_dialogLayout->addWidget(title, 0, 0, 1, 3);
-}
-
-KGetPanelBar::Private::~Private()
-{
-}
-
-void KGetPanelBar::Private::transfersAdded(const QList<OrgKdeKgetTransferInterface*> &transfers)
-{
- foreach (OrgKdeKgetTransferInterface* transfer, transfers) {
- QLabel *icon = new QLabel(this);
- QLabel *name = new QLabel(this);
- QProgressBar *progressBar = new QProgressBar(this);
-
- QString fileName = KUrl(transfer->source().value()).fileName();
- icon->setPixmap(KIO::pixmapForUrl(fileName, 0, KIconLoader::Desktop, 16));
- name->setText(fileName);
- name->setStyleSheet(QString("color: %1;").
- arg(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor).name()));
- progressBar->setValue(transfer->percent().value());
-
- int row = m_dialogLayout->rowCount();
-
- m_dialogLayout->addWidget(icon, row, 0);
- m_dialogLayout->addWidget(name, row, 1);
- m_dialogLayout->addWidget(progressBar, row, 2);
-
- m_transfers.insert(transfer, progressBar);
- }
-}
-
-void KGetPanelBar::Private::transfersRemoved(const QList<OrgKdeKgetTransferInterface*> &transfers)
-{
- foreach (OrgKdeKgetTransferInterface* transfer, transfers) {
- int index = m_dialogLayout->indexOf(m_transfers[transfer]);
- int row, column, rowSpan, columnSpan;
- m_dialogLayout->getItemPosition(index, &row, &column, &rowSpan, &columnSpan);
- kDebug() << row;
-
- QList<QLayoutItem*> items;
- for (int i = 0; i != 3; i++) {
- QLayoutItem * item = m_dialogLayout->itemAtPosition(row, i);
- items << item;
- m_dialogLayout->removeItem(item);
- delete item->widget();
- delete item;
- }
-
- m_transfers.remove(transfer);
- }
-}
-
-void KGetPanelBar::Private::update()
-{
- int totalSize = 0;
- int completedSize = 0;
- QMap<OrgKdeKgetTransferInterface*, QProgressBar*>::const_iterator it;
- QMap<OrgKdeKgetTransferInterface*, QProgressBar*>::const_iterator itEnd = m_transfers.constEnd();
- for (it = m_transfers.constBegin(); it != itEnd; ++it) {
- OrgKdeKgetTransferInterface *transfer = it.key();
- (*it)->setValue(transfer->percent().value());
- totalSize += transfer->totalSize().value();
- completedSize += transfer->downloadedSize().value();
- }
- if (totalSize > 0) {
- emit progressBarChanged((int) ((completedSize * 100) / totalSize));
- }
- else {
- emit progressBarChanged(0);
- }
-}
-
-void KGetPanelBar::Private::clear()
-{
- // TODO : Find another way to remove all layout widgets except the title one
- for (int row = 1; row < m_dialogLayout->rowCount(); ++row) {
- delete m_dialogLayout->itemAtPosition(row, 0);
- delete m_dialogLayout->itemAtPosition(row, 1);
- delete m_dialogLayout->itemAtPosition(row, 2);
-
- m_dialogLayout->removeItem(m_dialogLayout->itemAtPosition(row, 0));
- m_dialogLayout->removeItem(m_dialogLayout->itemAtPosition(row, 1));
- m_dialogLayout->removeItem(m_dialogLayout->itemAtPosition(row, 2));
- }
- m_transfers.clear();
-}
-
-
-KGetPanelBar::KGetPanelBar(QObject *parent, const QVariantList &args)
- : KGetApplet(parent, args),
- m_icon(0),
- d(new KGetPanelBar::Private())
-{
- d->setFocusPolicy(Qt::NoFocus);
- connect(this, SIGNAL(transfersAdded(QList<OrgKdeKgetTransferInterface*>)), d, SLOT(transfersAdded(QList<OrgKdeKgetTransferInterface*>)));
- connect(this, SIGNAL(transfersRemoved(QList<OrgKdeKgetTransferInterface*>)), d, SLOT(transfersRemoved(QList<OrgKdeKgetTransferInterface*>)));
- setBackgroundHints(Applet::NoBackground);
-}
-
-KGetPanelBar::~KGetPanelBar()
-{
- delete d;
- delete m_bar;
-}
-
-void KGetPanelBar::init()
-{
- KGlobal::locale()->insertCatalog("plasma_applet_kget");
-
- m_icon = new Plasma::IconWidget(KIcon("go-down"), QString(), this);
-
- m_layout = new QGraphicsLinearLayout(Qt::Horizontal, this);
- m_layout->addItem(m_icon);
-
- QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this);
-
- m_bar = new QProgressBar();
-
- connect(d, SIGNAL(progressBarChanged(int)), m_bar, SLOT(setValue(int)));
-
- proxy->setWidget(m_bar);
-
- m_bar->setValue(0);
- m_bar->setStyleSheet("background-color: transparent");
-
- m_layout->addItem(proxy);
-
- setLayout(m_layout);
-
- connect(m_icon, SIGNAL(clicked()), SLOT(showDialog()));
-
- KGetApplet::init();
-}
-
-void KGetPanelBar::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)
-{
- Q_UNUSED(p)
- Q_UNUSED(option)
- Q_UNUSED(contentsRect)
-}
-
-void KGetPanelBar::dataUpdated(const QString &source, const Plasma::DataEngine::Data &data)
-{
- Q_UNUSED(source)
-
- if(data["error"].toBool()) {
- kDebug() << "Error : " << data["errorMessage"].toString();
- d->clear();
- }
- else if(!data["error"].toBool()) {
- setTransfers(data["transfers"].toMap());
- d->update();
- }
-}
-
-void KGetPanelBar::showDialog()
-{
- if (d->isVisible()) {
- d->hide();
- }
- else {
- d->show();
- KWindowSystem::setState(d->winId(), NET::SkipTaskbar);
- d->move(popupPosition(d->sizeHint()));
- }
-}
-
-#include "moc_kgetpanelbar.cpp"
-#include "moc_kgetpanelbar_p.cpp"
+++ /dev/null
-/***************************************************************************
- * *
- * 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 KGETPANELBAR_H
-#define KGETPANELBAR_H
-
-#include "common/kgetapplet.h"
-#include <plasma/dataengine.h>
-
-#include <QGraphicsProxyWidget>
-#include <QGraphicsLinearLayout>
-#include <QProgressBar>
-
-namespace Plasma {
- class Dialog;
- class IconWidget;
-}
-
-class KGetPanelBar : public KGetApplet
-{
- Q_OBJECT
-public:
- KGetPanelBar(QObject *parent, const QVariantList &args);
- ~KGetPanelBar();
-
- void init();
- void paintInterface(QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- const QRect &contentsRect);
-
-public slots:
- void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
-
-private slots:
- void showDialog();
-
-private:
- Plasma::DataEngine *m_engine;
- Plasma::IconWidget *m_icon;
- QProgressBar * m_bar;
- QGraphicsLinearLayout *m_layout;
-
- class Private;
- Private *d;
-};
-
-K_EXPORT_PLASMA_APPLET(kgetpanelbar, KGetPanelBar)
-
-#endif
+++ /dev/null
-/***************************************************************************
- * *
- * 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 KGETPANELBAR_P_H
-#define KGETPANELBAR_P_H
-
-#include <plasma/dialog.h>
-#include <QList>
-#include <QMap>
-#include "transfer_interface.h"
-
-#include <QProgressBar>
-#include <QGridLayout>
-
-class KGetPanelBar::Private : public Plasma::Dialog
-{
-Q_OBJECT
-public:
- Private(QWidget * parent = 0);
- ~Private();
-
- QGridLayout *dialogLayout() {
- return m_dialogLayout;
- };
-
-public slots:
- void transfersAdded(const QList<OrgKdeKgetTransferInterface*> &transfers);
- void transfersRemoved(const QList<OrgKdeKgetTransferInterface*> &transfers);
- void update();
- void clear();
-
-signals:
- void progressBarChanged(int value);
-
-private:
- QProgressBar *m_bar;
- QGridLayout *m_dialogLayout;
- QWidget *m_widget;
-
- QMap<OrgKdeKgetTransferInterface*, QProgressBar*> m_transfers;
-};
-
-#endif
+++ /dev/null
-[Desktop Entry]
-Encoding=UTF-8
-Name=KGet Panelbar Applet
-Name[ast]=Miniaplicación barres de panel de KGet
-Name[bs]=panelska traka KGeta
-Name[ca]=Miniaplicació del KGet per la barra del plafó
-Name[ca@valencia]=Miniaplicació del KGet per la barra del plafó
-Name[cs]=Graf do panelu pro KGet
-Name[da]=KGet panel-applet
-Name[de]=KGet Kontrollleisten-Modul
-Name[el]=Μικροεφαρμογή γραμμής πίνακα KGet
-Name[en_GB]=KGet Panelbar Applet
-Name[es]=Miniaplicación de barra de panel de KGet
-Name[et]=KGeti paneeliriba aplett
-Name[eu]=KGet-eko panel-barraren miniaplikazioa
-Name[fi]=KGetin paneelisovelma
-Name[fr]=Composant graphique de barre latérale pour KGet
-Name[ga]=Feidhmchláirín barra painéil KGet
-Name[gl]=Applet de panel de KGet
-Name[hr]=Applet za panelnu traku za KGet
-Name[hu]=KGet panelsáv
-Name[ia]=Applet Panelchart de KGet (carta a pannello)
-Name[it]=Barra del pannello per KGet
-Name[ja]=KGet パネルバーアプレット
-Name[kk]=KGet бағанды диаграмма апплеті
-Name[km]=អាប់ភ្លេតរបារបន្ទះរបស់ KGet
-Name[ko]=KGet 패널 막대 애플릿
-Name[lt]=KGet Panelbar programėlė
-Name[lv]=KGet paneļa sīkrīks
-Name[nb]=Miniprogram for KGet-panelstolpe
-Name[nds]=KGet-Paneelbalken-Lüttprogramm
-Name[nl]=Paneelbalkapplet voor KGet
-Name[nn]=KGet-panellinje
-Name[pa]=ਕੇ-ਗਿੱਟ ਪੈਨਲਬਾਰ ਐਪਲਿਟ
-Name[pl]=Wykres w panelu KGet
-Name[pt]='Applet' de Barra de Painéis do KGet
-Name[pt_BR]=Miniaplicativo de barra de painel do KGet
-Name[ro]=Miniaplicație KGet BarăPanou
-Name[ru]=KGet: индикатор загрузки
-Name[si]=KGet පැනලතීරු යෙදුම
-Name[sk]=Graf do panela pre KGet
-Name[sl]=KGet (graf za pult)
-Name[sr]=панелска трака К‑гета
-Name[sr@ijekavian]=панелска трака К‑гета
-Name[sr@ijekavianlatin]=panelska traka KGeta
-Name[sr@latin]=panelska traka KGeta
-Name[sv]=Panelrad-miniprogram för Kget
-Name[tr]=KGet Panel Programcığı
-Name[ug]=KGet تاختا بالداق ئەپچە
-Name[uk]=Аплет стовпчикової діаграми KGet
-Name[x-test]=xxKGet Panelbar Appletxx
-Name[zh_CN]=KGet 面板栏小程序
-Name[zh_TW]=KGet 面板列小程式
-Comment=KGet panelbar applet
-Comment[ar]=بريمج عمود التحكم KGet
-Comment[ast]=Miniaplicación barres de panel de KGet
-Comment[bs]=Aplet panelske trake za KGet
-Comment[ca]=Miniaplicació del KGet per la barra del plafó
-Comment[ca@valencia]=Miniaplicació del KGet per la barra del plafó
-Comment[cs]=Graf do panelu pro KGet
-Comment[da]=KGet panel-applet
-Comment[de]=KGet Kontrollleisten-Modul
-Comment[el]=Μικροεφαρμογή γραμμής πίνακα KGet
-Comment[en_GB]=KGet panelbar applet
-Comment[es]=Miniaplicación de barra de panel de KGet
-Comment[et]=KGeti paneeliriba aplett
-Comment[eu]=KGet-eko panel-barraren miniaplikazioa
-Comment[fi]=KGetin paneelisovelma
-Comment[fr]=Composant graphique de barre latérale pour KGet
-Comment[ga]=Feidhmchláirín barra painéil KGet
-Comment[gl]=Applet de panel de KGet
-Comment[hne]=केगेट पेनलबार ऐप्लेट
-Comment[hr]=Applet za panelnu traku za KGet
-Comment[hu]=KGet panelsáv
-Comment[ia]=Applet Panelchart de KGet (carta a pannello)
-Comment[it]=Barra del pannello per KGet
-Comment[ja]=KGet パネルバーアプレット
-Comment[kk]=KGet бағанды диаграммасының апплеті
-Comment[km]=អាប់ភ្លេតរបារបន្ទះរបស់ KGet
-Comment[ko]=KGet 패널 막대 애플릿
-Comment[lt]=KGet panelbar programėlė
-Comment[lv]=KGet paneļa sīkrīks
-Comment[ml]=കെഗെറ്റ് പാനല്ബാര് എന്ന ലഘുപ്രയോഗം
-Comment[nb]=Miniprogram for KGet-panelstolpe
-Comment[nds]=Paneelbalken-Lüttprogramm för KGet
-Comment[nl]=Paneelbalkapplet voor KGet
-Comment[nn]=KGet-panellinje
-Comment[pa]=ਕੇਗਿੱਟ ਪੈਨਲਬਾਰ ਐਪਲਿਟ
-Comment[pl]=Aplet KGet pokazujący pasek panelu
-Comment[pt]='Applet' de barra de painéis do KGet
-Comment[pt_BR]=Miniaplicativo de barra de painel do KGet
-Comment[ro]=Miniaplicație KGet BarăPanou
-Comment[ru]=Показывает загрузки KGet
-Comment[si]=KGet පැනලතීරු යෙදුම
-Comment[sk]=Graf do panela pre KGet
-Comment[sl]=Graf za pult za KGet
-Comment[sr]=Аплет панелске траке за К‑гет
-Comment[sr@ijekavian]=Аплет панелске траке за К‑гет
-Comment[sr@ijekavianlatin]=Aplet panelske trake za KGet
-Comment[sr@latin]=Aplet panelske trake za KGet
-Comment[sv]=Panelrad-miniprogram för Kget
-Comment[tr]=KGet panel programcığı
-Comment[ug]=KGet تاختا بالداق ئەپچە
-Comment[uk]=Аплет стовпчикової діаграми KGet
-Comment[x-test]=xxKGet panelbar appletxx
-Comment[zh_CN]=KGet 面板栏小程序
-Comment[zh_TW]=KGet 面板列小程式
-Icon=kget
-Type=Service
-ServiceTypes=Plasma/Applet
-
-X-KDE-Library=plasma_kget_panelbar
-
-X-KDE-PluginInfo-Author=Javier Goday
-X-KDE-PluginInfo-Email=
-X-KDE-PluginInfo-Name=kgetpanelbar
-X-KDE-PluginInfo-Version=0.1
-X-KDE-PluginInfo-Website=http://plasma.kde.org/
-X-KDE-PluginInfo-Category=Online Services
-X-KDE-PluginInfo-Depends=
-X-KDE-PluginInfo-License=GPL
-X-KDE-PluginInfo-EnabledByDefault=true
-