[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace
From: Marco Martin <notmart () gmail ! com>
Date: 2010-07-08 17:58:26
Message-ID: 20100708180753.F2E55AC85D () svn ! kde ! org
[Download RAW message or body]
SVN commit 1147565 by mart:
no more orientation, use locations
M +11 -6 libs/plasmagenericshell/abstracticonlist.cpp
M +5 -3 libs/plasmagenericshell/abstracticonlist.h
M +1 -1 libs/plasmagenericshell/tests/main.cpp
M +5 -5 libs/plasmagenericshell/widgetsexplorer/appletslist.cpp
M +1 -1 libs/plasmagenericshell/widgetsexplorer/appletslist.h
M +23 -17 libs/plasmagenericshell/widgetsexplorer/widgetexplorer.cpp
M +7 -7 libs/plasmagenericshell/widgetsexplorer/widgetexplorer.h
M +2 -2 plasma/desktop/shell/activitymanager/activitylist.cpp
M +1 -1 plasma/desktop/shell/activitymanager/activitylist.h
M +2 -2 plasma/desktop/shell/activitymanager/activitymanager.cpp
M +3 -3 plasma/desktop/shell/controllerwindow.cpp
M +1 -1 plasma/desktop/shell/dashboardview.cpp
M +5 -7 plasma/netbook/shell/plasmaapp.cpp
M +1 -1 plasma/screensaver/shell/saverview.cpp
--- trunk/KDE/kdebase/workspace/libs/plasmagenericshell/abstracticonlist.cpp \
#1147564:1147565 @@ -47,7 +47,7 @@
namespace Plasma
{
-AbstractIconList::AbstractIconList(Qt::Orientation orientation, QGraphicsItem \
*parent) +AbstractIconList::AbstractIconList(Plasma::Location loc, QGraphicsItem \
*parent) : QGraphicsWidget(parent),
m_arrowsSvg(new Plasma::Svg(this)),
m_searchDelayTimer(new QTimer(this)),
@@ -57,7 +57,8 @@
m_scrollStep = 0;
m_firstItemIndex = 0;
m_selectedItem = 0;
- m_orientation = orientation;
+ m_location = loc;
+ m_orientation = ((loc == Plasma::LeftEdge || loc == \
Plasma::RightEdge)?Qt::Vertical:Qt::Horizontal);
//timer stuff
m_searchDelayTimer->setSingleShot(true);
@@ -182,15 +183,19 @@
return QObject::eventFilter(obj, event);
}
-Qt::Orientation AbstractIconList::orientation()
+Plasma::Location AbstractIconList::location()
{
- return m_orientation;
+ return m_location;
}
-void AbstractIconList::setOrientation(Qt::Orientation orientation)
+void AbstractIconList::setLocation(Plasma::Location location)
{
- m_orientation = orientation;
+ if (m_location == location) {
+ return;
+ }
+ m_orientation = ((location == Plasma::LeftEdge || location == \
Plasma::RightEdge)?Qt::Vertical:Qt::Horizontal); +
m_appletListLinearLayout->invalidate();
m_appletListLinearLayout->setOrientation(m_orientation);
m_arrowsLayout->setOrientation(m_orientation);
--- trunk/KDE/kdebase/workspace/libs/plasmagenericshell/abstracticonlist.h \
#1147564:1147565 @@ -27,6 +27,7 @@
#include <QGraphicsLinearLayout>
#include <QWeakPointer>
+#include <Plasma/Plasma>
#include <Plasma/Svg>
#include <plasma/widgets/toolbutton.h>
@@ -45,11 +46,11 @@
Q_OBJECT
public:
- AbstractIconList(Qt::Orientation orientation = Qt::Horizontal, QGraphicsItem \
*parent = 0); + AbstractIconList(Plasma::Location location = Plasma::BottomEdge, \
QGraphicsItem *parent = 0); ~AbstractIconList();
- void setOrientation(Qt::Orientation orientation);
- Qt::Orientation orientation();
+ void setLocation(Plasma::Location location);
+ Plasma::Location location();
// default size of the icons
void setIconSize(int size);
@@ -151,6 +152,7 @@
Plasma::Svg *m_arrowsSvg;
Qt::Orientation m_orientation;
+ Plasma::Location m_location;
Plasma::ItemBackground *m_hoverIndicator;
--- trunk/KDE/kdebase/workspace/libs/plasmagenericshell/tests/main.cpp \
#1147564:1147565 @@ -21,7 +21,7 @@
appletBrowser = new Plasma::WidgetExplorer();
appletBrowser->setContainment(containment);
- appletBrowser->setOrientation(orientation);
+ appletBrowser->setLocation(Plasma::BottomEdge);
appletBrowser->populateWidgetList();
Plasma::Corona *scene = new Plasma::Corona();
--- trunk/KDE/kdebase/workspace/libs/plasmagenericshell/widgetsexplorer/appletslist.cpp \
#1147564:1147565 @@ -37,8 +37,8 @@
using namespace KCategorizedItemsViewModels;
-AppletsListWidget::AppletsListWidget(Qt::Orientation orientation, QGraphicsItem \
*parent)
- : AbstractIconList(orientation, parent)
+AppletsListWidget::AppletsListWidget(Plasma::Location location, QGraphicsItem \
*parent) + : AbstractIconList(location, parent)
{
toolTipMoveTimeLine.setFrameRange(0, 100);
toolTipMoveTimeLine.setCurveShape(QTimeLine::EaseInOutCurve);
@@ -197,10 +197,10 @@
toolTipMoveTo = QPoint(appletPosition.x(), appletPosition.y());
}
- if (orientation() == Qt::Horizontal) {
+ if (location() == Plasma::LeftEdge || location() == Plasma::RightEdge) {
+ toolTipMoveFrom.setX(toolTipMoveTo.x());
+ } else {
toolTipMoveFrom.setY(toolTipMoveTo.y());
- } else {
- toolTipMoveFrom.setX(toolTipMoveTo.x());
}
m_toolTip->move(toolTipMoveTo);
--- trunk/KDE/kdebase/workspace/libs/plasmagenericshell/widgetsexplorer/appletslist.h \
#1147564:1147565 @@ -37,7 +37,7 @@
Q_OBJECT
public:
- AppletsListWidget(Qt::Orientation orientation = Qt::Horizontal, QGraphicsItem \
*parent = 0); + AppletsListWidget(Plasma::Location location = Plasma::BottomEdge, \
QGraphicsItem *parent = 0); ~AppletsListWidget();
//not used yet and probably never will be
--- trunk/KDE/kdebase/workspace/libs/plasmagenericshell/widgetsexplorer/widgetexplorer.cpp \
#1147564:1147565 @@ -68,10 +68,10 @@
}
void initFilters();
- void init(Qt::Orientation orientation);
+ void init(Plasma::Location loc);
void initRunningApplets();
void containmentDestroyed();
- void setOrientation(Qt::Orientation orientation);
+ void setLocation(Plasma::Location loc);
/**
* Tracks a new running applet
@@ -83,7 +83,9 @@
*/
void appletRemoved(Plasma::Applet *applet);
+ //this orientation is just for convenience, is the location that is important
Qt::Orientation orientation;
+ Plasma::Location location;
WidgetExplorer *q;
Plasma::ToolButton *close;
QString application;
@@ -142,15 +144,16 @@
appletsListWidget->setFilterModel(&filterModel);
}
-void WidgetExplorerPrivate::init(Qt::Orientation orient)
+void WidgetExplorerPrivate::init(Plasma::Location loc)
{
//init widgets
- orientation = orient;
+ location = loc;
+ orientation = ((location == Plasma::LeftEdge || location == \
Plasma::RightEdge)?Qt::Vertical:Qt::Horizontal); mainLayout = new \
QGraphicsLinearLayout(Qt::Vertical); mainLayout->setSpacing(0);
filteringLayout = new QGraphicsLinearLayout(Qt::Horizontal);
filteringWidget = new FilteringWidget(orientation, q);
- appletsListWidget = new AppletsListWidget(orientation);
+ appletsListWidget = new AppletsListWidget(location);
close = new Plasma::ToolButton;
close->setIcon(KIcon("dialog-close"));
@@ -188,15 +191,16 @@
q->setLayout(mainLayout);
}
-void WidgetExplorerPrivate::setOrientation(Qt::Orientation orient)
+void WidgetExplorerPrivate::setLocation(Plasma::Location loc)
{
- if (orientation == orient) {
+ if (location == loc) {
return;
}
- orientation = orient;
+ location = loc;
+ orientation = ((location == Plasma::LeftEdge || location == \
Plasma::RightEdge)?Qt::Vertical:Qt::Horizontal); \
filteringWidget->setListOrientation(orientation);
- appletsListWidget->setOrientation(orientation);
+ appletsListWidget->setLocation(loc);
if (orientation == Qt::Horizontal) {
mainLayout->removeItem(filteringWidget);
mainLayout->removeItem(close);
@@ -281,18 +285,18 @@
//WidgetExplorer
-WidgetExplorer::WidgetExplorer(Qt::Orientation orientation, QGraphicsItem *parent)
+WidgetExplorer::WidgetExplorer(Plasma::Location loc, QGraphicsItem *parent)
:QGraphicsWidget(parent),
d(new WidgetExplorerPrivate(this))
{
- d->init(orientation);
+ d->init(loc);
}
WidgetExplorer::WidgetExplorer(QGraphicsItem *parent)
:QGraphicsWidget(parent),
d(new WidgetExplorerPrivate(this))
{
- d->init(Qt::Horizontal);
+ d->init(Plasma::BottomEdge);
}
WidgetExplorer::~WidgetExplorer()
@@ -300,15 +304,15 @@
delete d;
}
-void WidgetExplorer::setOrientation(Qt::Orientation orientation)
+void WidgetExplorer::setLocation(Plasma::Location loc)
{
- d->setOrientation(orientation);
- emit(orientationChanged(orientation));
+ d->setLocation(loc);
+ emit(locationChanged(loc));
}
-Qt::Orientation WidgetExplorer::orientation()
+Plasma::Location WidgetExplorer::location()
{
- return d->orientation;
+ return d->location;
}
void WidgetExplorer::setIconSize(int size)
@@ -352,6 +356,8 @@
if (d->containment) {
connect(d->containment, SIGNAL(destroyed(QObject*)), this, \
SLOT(containmentDestroyed()));
connect(d->containment, \
SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, \
SLOT(immutabilityChanged(Plasma::ImmutabilityType))); +
+ setLocation(containment->location());
}
d->initRunningApplets();
--- trunk/KDE/kdebase/workspace/libs/plasmagenericshell/widgetsexplorer/widgetexplorer.h \
#1147564:1147565 @@ -47,7 +47,7 @@
Q_OBJECT
public:
- explicit WidgetExplorer(Qt::Orientation orientation, QGraphicsItem *parent = 0);
+ explicit WidgetExplorer(Plasma::Location loc, QGraphicsItem *parent = 0);
explicit WidgetExplorer(QGraphicsItem *parent = 0);
~WidgetExplorer();
@@ -79,16 +79,16 @@
Plasma::Corona *corona() const;
/**
- * Set the orientation of the widget explorer
+ * Set the location of the widget explorer
*
- * @arg the new orientation
+ * @arg the new location
*/
- void setOrientation(Qt::Orientation orientation);
+ void setLocation(Plasma::Location loc);
/**
- * @return the orientation of the widget explorer
+ * @return the location of the widget explorer
*/
- Qt::Orientation orientation();
+ Plasma::Location location();
/**
* Sets the icon size for the widget explorer
@@ -101,7 +101,7 @@
int iconSize() const;
Q_SIGNALS:
- void orientationChanged(Qt::Orientation orientation);
+ void locationChanged(Plasma::Location loc);
void closeClicked();
public Q_SLOTS:
--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activitymanager/activitylist.cpp \
#1147564:1147565 @@ -28,8 +28,8 @@
#include <Plasma/Containment>
#include <Plasma/Corona>
-ActivityList::ActivityList(Qt::Orientation orientation, QGraphicsItem *parent)
- : AbstractIconList(orientation, parent),
+ActivityList::ActivityList(Plasma::Location location, QGraphicsItem *parent)
+ : AbstractIconList(location, parent),
m_activityController(new KActivityController(this))
{
QStringList activities = m_activityController->availableActivities();
--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activitymanager/activitylist.h \
#1147564:1147565 @@ -36,7 +36,7 @@
Q_OBJECT
public:
- ActivityList(Qt::Orientation orientation = Qt::Horizontal, QGraphicsItem *parent \
= 0); + ActivityList(Plasma::Location location = Plasma::BottomEdge, QGraphicsItem \
*parent = 0); ~ActivityList();
protected:
--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activitymanager/activitymanager.cpp \
#1147564:1147565 @@ -81,7 +81,7 @@
mainLayout->setSpacing(0);
filteringLayout = new QGraphicsLinearLayout(Qt::Horizontal);
filteringWidget = new FilterBar(orientation, q);
- activityList = new ActivityList(orientation);
+ activityList = new ActivityList(containment->location());
close = new Plasma::ToolButton;
close->setIcon(KIcon("dialog-close"));
@@ -126,7 +126,7 @@
//FIXME bet I could make this more efficient
orientation = orient;
filteringWidget->setOrientation(orientation);
- activityList->setOrientation(orientation);
+ activityList->setLocation(containment->location());
if (orientation == Qt::Horizontal) {
mainLayout->removeItem(filteringWidget);
mainLayout->removeItem(close);
--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/controllerwindow.cpp \
#1147564:1147565 @@ -296,7 +296,7 @@
//FIXME maybe I should make these two inherit from something
//or make orientation a slot.
if (m_watchedWidget == (QGraphicsWidget*)m_widgetExplorer) {
- m_widgetExplorer->setOrientation(orientation());
+ m_widgetExplorer->setLocation(location());
} else {
m_activityManager->setOrientation(orientation());
}
@@ -354,7 +354,7 @@
}
if (!m_widgetExplorer) {
- m_widgetExplorer = new Plasma::WidgetExplorer(orientation());
+ m_widgetExplorer = new Plasma::WidgetExplorer(location());
m_watchedWidget = m_widgetExplorer;
m_widgetExplorer->setContainment(m_containment.data());
m_widgetExplorer->populateWidgetList();
@@ -375,7 +375,7 @@
connect(m_widgetExplorer, SIGNAL(closeClicked()), this, SLOT(close()));
} else {
- m_widgetExplorer->setOrientation(orientation());
+ m_widgetExplorer->setLocation(location());
m_widgetExplorer->show();
m_watchedWidget = m_widgetExplorer;
setGraphicsWidget(m_widgetExplorer);
--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/dashboardview.cpp \
#1147564:1147565 @@ -201,7 +201,7 @@
m_widgetExplorer = widgetExplorer;
widgetExplorer->installEventFilter(this);
widgetExplorer->setContainment(c);
- widgetExplorer->setOrientation(Qt::Horizontal);
+ widgetExplorer->setLocation(Plasma::BottomEdge);
widgetExplorer->setIconSize(KIconLoader::SizeHuge);
widgetExplorer->populateWidgetList();
widgetExplorer->setMaximumWidth(width());
--- trunk/KDE/kdebase/workspace/plasma/netbook/shell/plasmaapp.cpp #1147564:1147565
@@ -926,16 +926,14 @@
m_widgetExplorerView->installEventFilter(this);
}
- const bool vert = m_controlBar->location() == Plasma::LeftEdge ||
- m_controlBar->location() == Plasma::RightEdge;
- m_widgetExplorer->setOrientation(vert ? Qt::Vertical : Qt::Horizontal);
+ m_widgetExplorer->setLocation(m_controlBar->location());
- if (m_widgetExplorer->orientation() == Qt::Horizontal) {
- m_widgetExplorer->setMinimumWidth(m_mainView->size().width());
- m_widgetExplorer->setMinimumHeight(-1);
- } else {
+ if (m_widgetExplorer->location() == Plasma::LeftEdge || \
m_widgetExplorer->location() == Plasma::RightEdge) { \
m_widgetExplorer->setMinimumWidth(-1); \
m_widgetExplorer->setMinimumHeight(m_mainView->size().height()); + } else {
+ m_widgetExplorer->setMinimumWidth(m_mainView->size().width());
+ m_widgetExplorer->setMinimumHeight(-1);
}
positionPanel();
--- trunk/KDE/kdebase/workspace/plasma/screensaver/shell/saverview.cpp \
#1147564:1147565 @@ -134,7 +134,7 @@
ScreenSaverWidgetExplorer *widgetExplorer = new \
ScreenSaverWidgetExplorer(c); widgetExplorer->installEventFilter(this);
widgetExplorer->setContainment(c);
- widgetExplorer->setOrientation(Qt::Horizontal);
+ widgetExplorer->setLocation(Plasma::BottomEdge);
widgetExplorer->setIconSize(KIconLoader::SizeHuge);
widgetExplorer->populateWidgetList();
widgetExplorer->setMaximumWidth(width());
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic