Remove dead groupingdesktop containment code, replaced by applets//grouping

Ack'ed by mart & d_ed
parent c943d72a
add_subdirectory(groupingdesktop)
add_subdirectory(lib)
add_subdirectory(desktop)
add_subdirectory(panel)
add_subdirectory(griddesktop)
Just a quick overview about the goals of this thing:
This little project will provide the user the ability to layout his applets
in a more advanced way. He will be able to group them inside special
QGraphicsWidgets called - can you believe it? - Groups, in a way that depends on the specific group.
So, e.g. there is a grid group that layouts the applets in a grid, a
floating group that leaves them free to move inside the group, and so on.
I developed a Desktop and a panel containment, that share a lib that manages the groups.
The applets are added to a group dropping them from the Add Widgets Explorer
or moving them over the group. If it is necessary (like in the grid group) a
drop zone will be shown (like the one in the panel).
=====================================================================
More technical stuff:
This is composed of a library and two containments.
The library consists of a base class for the containments,
GroupingContainment, a base class for the groups, AbstractGroup, and a base class
for the handles, Handle, 'cause I realised that the normal Handle doesn't fit, e.g., for the
applets in the GridGroup.
This classes provide all the things needed to write a group or
a containment with grouping support and they co-operate well
together.
In order to be able to have many types of groups with their different needs
when speaking of saving the configuration, I moved this from the containment
to the groups: AbstractGroup has two pure virtual methods,
saveChildLayoutInfo(QGraphicsWidget *child, KConfigGroup &group) and
restoreChildLayoutInfo(QGraphicsWidget *child, KConfigGroup &group) which its subclasses
must reimplement, which actually save and restore the configuration. This
way it isn't the containment that saves, but it delegates this to the
specific groups that know how the applets are arranged and so they know the best
way to save the configuration. The grid group saves "Row" and "Column", the
tab group saves a "Index" and so on. These information are saved in the config section of
every applet inside a group called [GroupInformation].
The containment saves for each Applet under the [GroupInformation] group the numerical
identifier of the group in which it was placed.
The configuration of the groups are instead saved in [Containments][Id][Groups][Id], following
the pattern used by Applet.
There is support for groups-in-groups too. Every group can contain every other group like
if it were an applet, follwing the above-said rules for the configuration.
The Handle class, which was stripped down from AppletHandle in kdelibs,
allow every group to define an handle that will be used for the widgets inside it.
AbstractGroup has a virtual function - Handle *createHandleForChild(QGraphicsWidget *child) -
called by the containment when an applet or group receives an hover event that creates an handle
for that child. AbstractGroup returns by default a FreeHandle (that actually is AppletHandle
modified to make it work with groups too) but GridGroup returns a GridHandle instead.
Unfortunately the class Handle isn't how i would like it to be. Since AppletHandle is quite
complex I don't understand well its internals, and there still needs to be a good separation
of the work between Handle and its derived classes. (Moreover, AppletHandle emits the Applet signal
appletTransformedByUser(), which is protected, so nor Handle nor its derived classes can't emit it.)
GroupingContainment has the support for a so-called MainGroup. That is, a group without the background
as big as the containment. This way I avoid to duplicate code. I mean, the panel containment
layouts its applets and groups in a grid. Instead of implementing in the panel code the grid
layout, the panels uses GroupingContainment::useMainGroup(const QString &groupType).
This way the panel sets a GridGroup as main group, so it delegates all the grid layouting to it.
On boot-up the containmnent looks for a "mainGroupId" entry in its config. If it finds it, it will
set the group with that id as main group, otherwise it will build a new one.
To simplify a bit the code, GroupingContainment assumes there is always a main group, and it sets
a FloatingGroup, which isn't noticeable, as the default.
Currently this main group system assumes the main group won't change, but I could modify it
to let it change in runtime, selected by the user. I have to think about it.
I built a factory which creates the groups. The groups register themselves to the factory with
the macro REGISTER_GROUP(name, class name), then GroupingContainment asks the factory for the list
of the names associated with the groups and builds them calling AbstractGroup::load(name).
Every group must have a static function - static QSet<Plasma::FormFactor> availableOnFormFactors() -
that returns the form factors in which the group makes sense. E.g. in the panel there isn't the space
for a tabbing group, so it returns only Plasma::Planar and Plasma::MediaCenter.
There are four groups right now, a grid group, a stack group, a floating group, and a tabbing group,
one desktop containment and a panel containment.
You might find AbstractGroup's API to be quite similar to the Applet's one. In fact I tried to keep
it more similar as possible to ease the development of groups.
======================================================================
Things still to investigate:
-different form factors in different groups;
-create a nice interface to add groups;
-decide if make the groups pluginnable.
set(groupingdesktop_SRCS groupingdesktop.cpp)
kde4_add_plugin(plasma_containment_groupingdesktop ${groupingdesktop_SRCS})
target_link_libraries(plasma_containment_groupingdesktop ${KDE4_PLASMA_LIBS} plasma_groupingcontainment)
install(TARGETS plasma_containment_groupingdesktop DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-containment-groupingdesktop.desktop DESTINATION ${SERVICES_INSTALL_DIR})
\ No newline at end of file
/*
* Copyright 2009-2010 by Giulio Camuffo <giuliocamuffo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, 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 Library 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 "groupingdesktop.h"
K_EXPORT_PLASMA_APPLET(groupingdesktop, GroupingDesktop)
GroupingDesktop::GroupingDesktop(QObject* parent, const QVariantList& args)
: GroupingContainment(parent, args)
{
setHasConfigurationInterface(true);
KGlobal::locale()->insertCatalog("libplasma_groupingcontainment");
}
GroupingDesktop::~GroupingDesktop()
{
}
void GroupingDesktop::init()
{
setContainmentType(Plasma::Containment::DesktopContainment);
GroupingContainment::init();
}
#include "groupingdesktop.moc"
/*
* Copyright 2009-2010 by Giulio Camuffo <giuliocamuffo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, 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 Library 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 GROUPINGDESKTOP_H
#define GROUPINGDESKTOP_H
#include "../lib/groupingcontainment.h"
class GroupingDesktop: public GroupingContainment
{
Q_OBJECT
public:
GroupingDesktop(QObject *parent, const QVariantList &args);
~GroupingDesktop();
void init();
};
#endif
[Desktop Entry]
Name=Grouping Desktop
Name[bs]=Grupirajuća radna površina
Name[ca]=Escriptori agrupat
Name[ca@valencia]=Escriptori agrupat
Name[cs]=Seskupovací pracovní plocha
Name[da]=Grupperingsskrivebord
Name[de]=Arbeitsflächengruppierung
Name[el]=Grouping Desktop
Name[en_GB]=Grouping Desktop
Name[es]=Escritorio de agrupamiento
Name[et]=Rühmitav töölaud
Name[eu]=Taldekatzeko mahaigaina
Name[fi]=Ryhmitelty työpöytä
Name[fr]=Regroupement de bureaux
Name[gl]=Escritorio de agrupamento
Name[he]=קיבוץ שולחן עבודה
Name[hr]=Grupirajuća radna površina
Name[hu]=Munkaasztal-csoportosítás
Name[it]=Desktop raggruppato
Name[kk]=Топтастыру үстелі
Name[km]=ដាក់​ផ្ទៃតុ​ជា​ក្រុម​
Name[ko]=데스크톱 그룹
Name[lt]=Darbalaukių grupavimas
Name[lv]=Darbvirsmu grupēšana
Name[mr]=डेस्कटॉप समूह
Name[nb]=GroupingDesktop
Name[nds]=Schriefdisch-Tosamenkoppeln
Name[nl]=Bureaublad groeperen
Name[nn]=Grupperingsskrivebord
Name[pa]=ਡੈਸਕਟਾਪ ਗਰਿੱਪ ਬਣਾਉ
Name[pl]=Pulpit grupujący
Name[pt]=Ecrã Agrupado
Name[pt_BR]=Área de trabalho agrupada
Name[ru]=Группирующая комната
Name[sk]=Plocha so skupinami
Name[sl]=Združevanje namizja
Name[sr]=Групишућа површ
Name[sr@ijekavian]=Групишућа површ
Name[sr@ijekavianlatin]=Grupišuća površ
Name[sr@latin]=Grupišuća površ
Name[sv]=Skrivbord med gruppering
Name[tr]=Grup Masaüstü
Name[uk]=Впорядкована стільниця
Name[x-test]=xxGrouping Desktopxx
Name[zh_CN]=分组桌面
Name[zh_TW]=群組桌面
Icon=user-desktop
Type=Service
X-KDE-ServiceTypes=Plasma/Containment
X-Plasma-ContainmentCategories=desktop
X-KDE-Library=plasma_containment_groupingdesktop
X-KDE-PluginInfo-Author=
X-KDE-PluginInfo-Email=giuliocamuffo@gmail.com
X-KDE-PluginInfo-Name=org.kde.groupingdesktop
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=http://userbase.kde.org/Plasma/GroupingDesktop
X-KDE-PluginInfo-Category=Containments
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
set(griddesktop_SRCS griddesktop.cpp)
kde4_add_plugin(plasma_containment_griddesktop ${griddesktop_SRCS})
target_link_libraries(plasma_containment_griddesktop ${KDE4_PLASMA_LIBS} plasma_groupingcontainment)
install(TARGETS plasma_containment_griddesktop DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-containment-griddesktop.desktop DESTINATION ${SERVICES_INSTALL_DIR})
\ No newline at end of file
/*
* Copyright 2009-2010 by Giulio Camuffo <giuliocamuffo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, 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 Library 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 "griddesktop.h"
#include <Plasma/Corona>
#include "../lib/abstractgroup.h"
K_EXPORT_PLASMA_APPLET(griddesktop, GridDesktop)
GridDesktop::GridDesktop(QObject* parent, const QVariantList& args)
: GroupingContainment(parent, args)
{
setHasConfigurationInterface(true);
KGlobal::locale()->insertCatalog("libplasma_groupingcontainment");
setContainmentType(Plasma::Containment::DesktopContainment);
useMainGroup("grid");
}
GridDesktop::~GridDesktop()
{
}
void GridDesktop::init()
{
connect(corona(), SIGNAL(availableScreenRegionChanged()), this, SLOT(layoutMainGroup()));
GroupingContainment::init();
}
void GridDesktop::layoutMainGroup()
{
QRectF rect = corona()->availableScreenRegion(screen()).boundingRect();
mainGroup()->setGeometry(rect);
}
#include "griddesktop.moc"
/*
* Copyright 2009-2010 by Giulio Camuffo <giuliocamuffo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, 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 Library 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 GRIDDESKTOP_H
#define GRIDDESKTOP_H
#include "../lib/groupingcontainment.h"
class GridDesktop: public GroupingContainment
{
Q_OBJECT
public:
GridDesktop(QObject *parent, const QVariantList &args);
~GridDesktop();
void init();
protected slots:
void layoutMainGroup();
};
#endif
[Desktop Entry]
Name=Grid Desktop
Name[bs]=Rešetkasta radna površina
Name[ca]=Escriptori en graella
Name[ca@valencia]=Escriptori en graella
Name[cs]=Mřížová pracovní plocha
Name[da]=Gitterskrivebord
Name[de]=Gitter-Arbeitsfläche
Name[el]=Grid Desktop
Name[en_GB]=Grid Desktop
Name[es]=Escritorio de cuadrícula
Name[et]=Võrgustikuga töölaud
Name[eu]=Sareta mahaigaina
Name[fi]=Ruudukollinen työpöytä
Name[fr]=Bureau en grille
Name[gl]=Escritorio en grade
Name[he]=רשת שולחן עבודה
Name[hu]=A munkaasztal megjelenítése
Name[it]=Griglia dei desktop
Name[kk]=Торлы үстел
Name[km]=ផ្ទៃតុ​ក្រឡាចត្រង្គ​
Name[ko]=데스크톱 그리드
Name[lt]=Darbalaukio tinklelis
Name[lv]=Darbvirsmu režģis
Name[mr]=डेस्कटॉप जाळे
Name[nb]=Rutenett-skrivebord
Name[nds]=Gadder-Schriefdisch
Name[nl]=Bureaubladraster
Name[nn]=Rutenettskrivebord
Name[pa]=ਡੈਸਕਟਾਪ ਗਰਿੱਡ
Name[pl]=Pulpit z siatką
Name[pt]=Ecrã em Grelha
Name[pt_BR]=Área de trabalho em grade
Name[ro]=Birou-grilă
Name[ru]=Клетчатая комната
Name[sk]=Plocha s mriežkou
Name[sl]=Namizje z mrežo
Name[sr]=Решеткаста површ
Name[sr@ijekavian]=Решеткаста површ
Name[sr@ijekavianlatin]=Rešetkasta površ
Name[sr@latin]=Rešetkasta površ
Name[sv]=Skrivbord med rutor
Name[tr]=Izgara Masaüstü
Name[uk]=Таблична стільниця
Name[x-test]=xxGrid Desktopxx
Name[zh_CN]=网格桌面
Name[zh_TW]=桌面格線
Icon=view-grid
Type=Service
X-KDE-ServiceTypes=Plasma/Containment
X-Plasma-ContainmentCategories=desktop
X-KDE-Library=plasma_containment_griddesktop
X-KDE-PluginInfo-Author=
X-KDE-PluginInfo-Email=giuliocamuffo@gmail.com
X-KDE-PluginInfo-Name=org.kde.griddesktop
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=http://userbase.kde.org/Plasma/GroupingDesktop
X-KDE-PluginInfo-Category=Containments
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
add_definitions(-DTRANSLATION_DOMAIN="libplasma_groupingcontainment")
set(groupingcontainment_SRCS
abstractgroup.cpp
groupinfo.cpp
groupfactory.cpp
groupingcontainment.cpp
handle.cpp
freehandle.cpp
gridhandle.cpp
spacer.cpp
groups/floatinggroup.cpp
groups/gridgroup.cpp
groups/gridmanager.cpp
groups/flowgroup.cpp
groups/stackinggroup.cpp
groups/tabbinggroup.cpp
groupexplorer/explorerwindow.cpp
groupexplorer/groupexplorer.cpp
groupexplorer/groupiconlist.cpp
groupexplorer/groupicon.cpp
)
kde4_add_ui_files(groupingcontainment_SRCS groups/tabbinggroup_config.ui)
kde4_add_library(plasma_groupingcontainment SHARED ${groupingcontainment_SRCS})
target_link_libraries(plasma_groupingcontainment ${KDE4_PLASMA_LIBS})
set_target_properties(plasma_groupingcontainment PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
install(TARGETS plasma_groupingcontainment EXPORT kdeworkspaceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
/** @mainpage Grouping Desktop library
This library is an add-on to libplasma that provide a way to group Plasma Applets
in various arrangements.
It is designed in a modular way, with the introduction of the class AbstractGroup
that can be subclassed to provide a new group type.
The other fundamental class is GroupingContainment that manages all the groups and
can be subclassed to create a new Containment with grouping support.
@authors
Giulio Camuffo \<giuliocamuffo@gmail.com\>
@maintainers
Giulio Camuffo \<giuliocamuffo@gmail.com\>
@licenses
@lgpl
*/
// DOXYGEN_SET_PROJECT_NAME = GroupingDesktop
// DOXYGEN_SET_RECURSIVE = YES
// DOXYGEN_EXCLUDE_PATTERNS = *_p.h */groups/*
// vim:ts=4:sw=4:expandtab:filetype=doxygen
#! /usr/bin/env bash
$EXTRACTRC $(find . -name "*.ui") >> rc.cpp
$XGETTEXT $(find . -name "*.cpp") -o $podir/libplasma_groupingcontainment.pot
rm -f rc.cpp
This diff is collapsed.
/*
* Copyright 2009-2010 by Giulio Camuffo <giuliocamuffo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, 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 Library 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 ABSTRACTGROUP_H
#define ABSTRACTGROUP_H
#include <QtGui/QGraphicsWidget>
#include <Plasma/Applet>
#include "groupinfo.h"
#include "groupfactory_p.h"
#include "groupingcontainment_export.h"
class KConfigGroup;
class GroupingContainment;
class Handle;
class AbstractGroupPrivate;
/**
* @class AbstractGroup
*
* @short The base Group class
*
* AbstractGroup is a base class for special widgets thoughts to contain Plasma::Applet
*/
class PLASMA_GROUPINGCONTAINMENT_EXPORT AbstractGroup : public QGraphicsWidget
{
Q_OBJECT
Q_PROPERTY(bool hasInterface READ hasConfigurationInterface)
Q_PROPERTY(uint id READ id)
Q_PROPERTY(GroupType groupType READ groupType)
Q_PROPERTY(bool isMainGroup READ isMainGroup)
public:
/**
* Defines if the applets inside the group can be freely transformed or not by the user
*/
enum GroupType {
ConstrainedGroup = 0, /**< The transformations of the applet are constrained by,
e.g. a layout */
FreeGroup = 1 /**< The applets can be freely transformed */
};
Q_ENUMS(GroupType)
/**
* Description on how draw a background for the group
*/
enum BackgroundHint {
NoBackground = 0, /**< Don't draw anything */
StandardBackground = 1, /**< Draw the translucent background from the theme */
PlainBackground = 2 /**< Draw a plain, simpler background */
};
Q_DECLARE_FLAGS(BackgroundHints, BackgroundHint)
/**
* Constructor of the abstract class.
**/
explicit AbstractGroup(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
/**
* Default destructor.
**/
virtual ~AbstractGroup();
/**
* Method called a little after the constructor.
* If you need methods like config() or containment() use them here,
* not in the constructor.
**/
virtual void init();
/**
* Returns the Group that contains this one, 0 if there is no one.
**/
AbstractGroup *parentGroup() const;
/**
* Adds an Applet to this Group.
*
* @param applet the Applet to be managed by this
* @param layoutApplet the parameter that defines if layoutChild(applet) will be called
*
* @see applets
* @see removeApplet
**/
void addApplet(Plasma::Applet *applet, bool layoutApplet = true);
/**
* Adds a Group to this Group.
*