kdeplasma-addons: drop borked magnifique applet

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-16 05:20:23 +03:00
parent 87fa5d6d47
commit fb09ddeb67
6 changed files with 0 additions and 417 deletions

View file

@ -7,7 +7,6 @@ add_subdirectory(frame)
add_subdirectory(kolourpicker)
add_subdirectory(konsoleprofiles)
add_subdirectory(life)
add_subdirectory(magnifique)
add_subdirectory(spellcheck)
add_subdirectory(timer)
add_subdirectory(eyes)

View file

@ -1,16 +0,0 @@
# Project Needs a name ofcourse
project(plasma-magnifique)
# We add our source code here
set(magnifique_SRCS magnifique.cpp)
# Now make sure all files get to the right place
kde4_add_plugin(plasma_applet_magnifique ${magnifique_SRCS})
target_link_libraries(plasma_applet_magnifique
KDE4::plasma KDE4::kdeui)
install(TARGETS plasma_applet_magnifique
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-magnifique.desktop
DESTINATION ${KDE4_SERVICES_INSTALL_DIR})

View file

@ -1,2 +0,0 @@
#! /usr/bin/env bash
$XGETTEXT *.cpp -o $podir/plasma_applet_magnifique.pot

View file

@ -1,220 +0,0 @@
/***************************************************************************
* Copyright 2008 by Marco Martin <notmart@gmail.com> *
* *
* 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. *
* *
* 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 "magnifique.h"
#include <QGraphicsView>
#include <QGraphicsProxyWidget>
#include <QGraphicsLinearLayout>
#include <QtGui/qgraphicssceneevent.h>
#include <QApplication>
#include <QSlider>
#include <QVBoxLayout>
#include <KWindowSystem>
#include <KIcon>
#include <Plasma/IconWidget>
#include <Plasma/Theme>
#include <Plasma/Dialog>
#include <Plasma/ToolTipManager>
#include <Plasma/Containment>
#include <Plasma/Corona>
#include <Plasma/View>
Magnifique::Magnifique(QObject *parent, const QVariantList &args)
: Plasma::Applet(parent, args),
m_view(0),
m_mainWindow(0)
{
resize(48, 48);
}
Magnifique::~Magnifique()
{
delete m_mainWindow;
}
void Magnifique::init()
{
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
Plasma::IconWidget *icon = new Plasma::IconWidget(this);
icon->setIcon(QLatin1String("zoom-in"));
layout->addItem(icon);
setAspectRatioMode(Plasma::ConstrainedSquare);
connect(icon, SIGNAL(clicked()), this, SLOT(toggleView()));
Plasma::ToolTipContent data;
data.setMainText(i18n("Magnifying glass"));
data.setSubText(i18n("See the contents of your desktop through the windows"));
data.setImage(KIcon(QLatin1String("zoom-in")));
Plasma::ToolTipManager::self()->setContent(this, data);
}
void Magnifique::toggleView()
{
if (!m_mainWindow) {
m_mainWindow = new QWidget;
QVBoxLayout *layout = new QVBoxLayout(m_mainWindow);
layout->setContentsMargins(0,0,0,0);
m_view = new QGraphicsView(m_mainWindow);
m_view->setScene(scene());
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_view->setWindowTitle(i18n("Plasma Magnifier"));
m_slider = new QSlider(Qt::Horizontal, m_mainWindow);
m_slider->setMinimum(-2);
m_slider->setMaximum(2);
m_slider->setPageStep(1);
connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(setZoom(int)));
layout->addWidget(m_view);
layout->addWidget(m_slider);
}
KConfigGroup conf = config();
if (m_mainWindow->isVisible()) {
conf.writeEntry("Geometry", m_mainWindow->geometry());
conf.writeEntry("Zoom", m_view->transform().m11());
m_mainWindow->removeEventFilter(this);
m_mainWindow->deleteLater();
m_mainWindow = 0;
} else {
QRect geom = conf.readEntry("Geometry", QRect(0, 0, 200, 200));
int zoom = conf.readEntry("Zoom", 1);
m_mainWindow->setGeometry(geom);
QTransform viewTransform;
viewTransform.setMatrix(zoom, 0, 0, 0, zoom, 0, 0, 0, 1);
m_view->setTransform(viewTransform);
m_mainWindow->show();
syncViewToScene();
m_mainWindow->installEventFilter(this);
}
}
void Magnifique::setZoom(int zoom)
{
QTransform transform;
if (zoom > 0) {
transform.scale(zoom*2, zoom*2);
} else if (zoom < 0) {
transform.scale(1/(-(qreal)zoom*2), 1/(-(qreal)zoom*2));
}
m_view->setTransform(transform);
syncViewToScene();
}
void Magnifique::syncViewToScene()
{
QRect mappedRect(m_view->transform().inverted().mapRect(QRect(QPoint(0,0), m_view->size())));
QPoint viewPos = m_view->mapToGlobal(m_view->pos());
QRect originalRect(scenePosFromScreenPos(QPoint(qMax(viewPos.x(), 0), qMax(viewPos.y(), 0))).toPoint(), m_view->size());
mappedRect.moveCenter(originalRect.center());
//avoid to show negative coordinates in the view - we don't want to show the panel :)
mappedRect.moveTop(qMax(mappedRect.top(), 0));
mappedRect.moveLeft(qMax(mappedRect.left(), 0));
m_view->setSceneRect(mappedRect);
}
bool Magnifique::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::Move || event->type() == QEvent::Resize) {
syncViewToScene();
return true;
}
return Applet::eventFilter(watched, event);
}
void Magnifique::wheelEvent(QGraphicsSceneWheelEvent *event)
{
if (!m_view) {
return;
}
qreal delta = 1;
//don't allow too big zooming, for speed reason :/
if (event->delta() < 0 && m_view->transform().m11() > 0.25) {
delta = 0.5;
} else if(event->delta() > 0 && m_view->transform().m11() < 4) {
delta = 2;
}
m_view->scale(delta, delta);
qreal factor = m_view->transform().m11();
if (factor > 1) {
m_slider->setValue(factor/2);
} else if (factor < 1 && factor > 0) {
m_slider->setValue(-((1/factor)/2));
} else {
m_slider->setValue(0);
}
syncViewToScene();
}
QPointF Magnifique::scenePosFromScreenPos(const QPoint &pos) const
{
Plasma::Corona *corona = containment()->corona();
Plasma::Containment *cont = 0;
if (corona) {
cont = corona->containmentForScreen(containment()->screen(), KWindowSystem::currentDesktop()-1);
if (!cont) {
cont = corona->containmentForScreen(containment()->screen(), -1);
}
}
if (!corona || !cont) {
return QPoint();
}
//get the stacking order of the toplevel windows and remove the toplevel view that's
//only here while dragging, since we're not interested in finding that.
QList<WId> order = KWindowSystem::stackingOrder();
Plasma::View *found = 0;
foreach (QWidget *w, QApplication::topLevelWidgets()) {
Plasma::View *v = qobject_cast<Plasma::View *>(w);
if (v && v->containment() == cont) {
found = v;
break;
}
}
if (!found) {
return QPointF();
}
return found->mapToScene(found->mapFromGlobal(pos));
}
#include "moc_magnifique.cpp"

View file

@ -1,63 +0,0 @@
/***************************************************************************
* Copyright 2008 by Marco Martin <notmart@gmail.com> *
* *
* 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. *
* *
* 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 MAGNIFIQUE_HEADER
#define MAGNIFIQUE_HEADER
#include <Plasma/Applet>
#include <QGraphicsView>
#include <QSlider>
#include <QWidget>
class Magnifique : public Plasma::Applet
{
Q_OBJECT
public:
Magnifique(QObject *parent, const QVariantList &args);
~Magnifique();
void init();
protected:
bool eventFilter(QObject *watched, QEvent *event);
void wheelEvent(QGraphicsSceneWheelEvent *event);
public Q_SLOTS:
void toggleView();
void setZoom(int zoom);
private:
void syncViewToScene();
QPointF scenePosFromScreenPos(const QPoint &pos) const;
QGraphicsView *m_view;
QWidget *m_mainWindow;
QSlider *m_slider;
};
K_EXPORT_PLASMA_APPLET(magnifique, Magnifique)
#endif

View file

@ -1,115 +0,0 @@
[Desktop Entry]
Name=Magnifique
Name[ar]=المكبر
Name[ast]=Magnifique
Name[bs]=Magnifique
Name[ca]=Magnifique
Name[ca@valencia]=Magnifique
Name[cs]=Magnifique
Name[da]=Magnifique
Name[de]=Vergrößerung
Name[el]=Μεγεθυντής
Name[en_GB]=Magnifique
Name[es]=Magnifique
Name[et]=Magnifique
Name[fi]=Suurennuslasi
Name[fr]=Loupe
Name[ga]=Magnifique
Name[gl]=Magnifique
Name[hr]=Magnifique
Name[hu]=Nagyító
Name[is]=Magnifique
Name[it]=Lente d'ingrandimento
Name[ja]=Magnifique
Name[kk]=Үлкейткіш
Name[km]=Magnifique
Name[ko]=
Name[lt]=Magnifique
Name[lv]=Magnifique
Name[mr]=ि
Name[nb]=Magnifique
Name[nds]=Magnifique
Name[nl]=Magnifique
Name[nn]=Forstørring
Name[pa]=
Name[pl]=Powiększanie
Name[pt]=Magnifique
Name[pt_BR]=Magnifique
Name[ro]=Magnifique
Name[ru]=Magnifique
Name[sk]=Lupa
Name[sl]=Magnifique
Name[sq]=Magnifique
Name[sr]=магнифик
Name[sr@ijekavian]=магнифик
Name[sr@ijekavianlatin]=magnifik
Name[sr@latin]=magnifik
Name[sv]=Magnifik
Name[tr]=Büyütücü
Name[uk]=Magnifique
Name[wa]=Magnifike
Name[x-test]=xxMagnifiquexx
Name[zh_CN]=
Name[zh_TW]=Magnifique
Comment=A magnification glass for the Plasma desktop
Comment[ar]=زجاج مكبِّر لسطح مكتب بلازما
Comment[bs]=Lupa za plazma površ
Comment[ca]=Una lent d'augment per l'escriptori Plasma
Comment[ca@valencia]=Una lent d'augment per l'escriptori Plasma
Comment[cs]=Zvětšovací sklo pro Plasma desktop
Comment[da]=Et forstørrelsesglas til Plasma-skrivebordet
Comment[de]=Ein Vergrößerungsglas für die Plasma-Arbeitsfläche
Comment[el]=Ένας μεγεθυντικός φακός για την επιφάνεια εργασίας Plasma
Comment[en_GB]=A magnification glass for the Plasma desktop
Comment[es]=Una lente de ampliación para el escritorio Plasma
Comment[et]=Plasma töölaua suurendusklaas
Comment[fi]=Plasma-työpöydän suurennuslasi
Comment[fr]=Une loupe pour le bureau Plasma
Comment[gl]=Un cristal de aumento para o escritorio de plasma
Comment[hr]=Povećalo za radnu površinu Plasme
Comment[hu]=Nagyító a Plazma munkaasztalhoz
Comment[it]=Una lente d'ingrandimento per il desktop Plasma
Comment[ja]=Plasma
Comment[kk]=Plasma үстелінің үлкейткіш лупасы
Comment[km]= magnification
Comment[ko]=Plasma
Comment[lt]=Padidinamasis stiklas Plasma darbastaliui
Comment[lv]=Palielināmais stikls Plasma darbvirsmai
Comment[mr]= ि ि
Comment[nb]=Et forstørrelsesglass for Plasma-skrivebordet
Comment[nds]=En Kiekglas för den Plasma-Schriefdisch
Comment[nl]=Een vergrootglas voor het Plasma bureaublad
Comment[nn]=Eit forstørringsglas til Plasma-skrivebordet
Comment[pa]=
Comment[pl]=Szkło powiększające dla pulpitu Plasma
Comment[pt]=Uma lupa de ampliação para o ambiente de trabalho Plasma
Comment[pt_BR]=Uma lente de aumento para a área de trabalho Plasma
Comment[ro]=Lupă pentru biroul Plasma
Comment[ru]=Лупа для рабочего стола Plasma
Comment[sk]=Zväčšovacie sklo pre plochu Plasmy
Comment[sl]=Povečevalno steklo za namizje Plasma
Comment[sr]=Лупа за плазма површ
Comment[sr@ijekavian]=Лупа за плазма површ
Comment[sr@ijekavianlatin]=Lupa za plasma površ
Comment[sr@latin]=Lupa za plasma površ
Comment[sv]=Ett förstoringsglas för Plasmaskrivbordet
Comment[tr]=Plasma masaüstü için bir büyüteç
Comment[uk]=Збільшувальне скло для стільниці Плазми
Comment[wa]=Ene loupe pol sicribanne Plasma
Comment[x-test]=xxA magnification glass for the Plasma desktopxx
Comment[zh_CN]=Plasma
Comment[zh_TW]=Plasma
Type=Service
Icon=zoom-in
X-KDE-ServiceTypes=Plasma/Applet
X-KDE-Library=plasma_applet_magnifique
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Email=notmart@gmail.com
X-KDE-PluginInfo-Name=magnifique
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=
X-KDE-PluginInfo-Category=
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true