[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: luna in kdereview, proposed move into extragear
From: "Aaron J. Seigo" <aseigo () kde ! org>
Date: 2008-02-13 17:06:33
Message-ID: 200802131006.34499.aseigo () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
On Wednesday 13 February 2008, Davide Bettio wrote:
> I just moved luna plasma applet to kdereview.
great =) i see you put it in kdreview/ itself; i've moved it into
kdreview/plasma/applets with the other applets under review.
comments:
* you could connect to the UTC data source of the Time DataEngine and avoid
updateStatus() altogether. you get both the time and the date there, and
QDateTime provides a toTime_t.
* where is it actually updating the contents? i don't see anything connected
to updateStatus(), and connectToEngine() isn't called anywhere? replace the
call to updateStatus() in init() with a call to connectToEngine and things
are happy (just tried)
* i wonder if the painting might look better at different if the moon images
were a bit bigger in the svg itself and you called
m_theme->resize(contentSize()) in constraintsUpdated when the SizeConstraint
is passed in
* you shouldn't need to call updateGeometry in constraintsUpdated (if you do,
there's a bug somewhere in libplasma =)
* you don't need that contentSizeHint there, or expandingDirections. just call
setRemainSquare(true) somewhere (e.g. the constructor of your applet)
see attached patch.
> Luna is a plasma applet based on the legacy kicker applet kmoon.
> I hope that the applet can be moved to extragear/plasma/applets/ after the
that looks like a good place for it.
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Trolltech
["luna.diff" (text/x-diff)]
Index: luna.cpp
===================================================================
--- luna.cpp (revision 774605)
+++ luna.cpp (working copy)
@@ -38,6 +38,7 @@
m_dialog(0)
{
setHasConfigurationInterface(true);
+ setRemainSquare(true);
resize(QSize(128, 128));
counter = -1;
@@ -57,56 +58,18 @@
northHemisphere = cg.readEntry("northHemisphere", true);
- updateStatus();
+ connectToEngine();
}
-void Luna::updateStatus()
-{
- struct tm * t;
- time_t clock;
-
- time(&clock);
- t = gmtime(&clock);
-
- calcStatus(mktime(t));
-}
-
Luna::~Luna()
{
}
-Qt::Orientations Luna::expandingDirections() const
-{
- return 0;
-}
-
-QSizeF Luna::contentSizeHint() const
-{
- QSizeF sizeHint = contentSize();
-
- switch (formFactor()) {
- case Plasma::Vertical:
- sizeHint.setHeight(sizeHint.width());
- break;
-
- case Plasma::Horizontal:
- sizeHint.setWidth(sizeHint.height());
- break;
-
- default:
- sizeHint.setWidth(sizeHint.height());
- break;
- }
-
- return sizeHint;
-}
-
void Luna::connectToEngine()
{
Plasma::DataEngine* timeEngine = dataEngine("time");
-
- timeEngine->connectSource("Local", this, 360000, Plasma::AlignToHour);
+ timeEngine->connectSource("UTC", this, 360000, Plasma::AlignToHour);
}
void Luna::constraintsUpdated(Plasma::Constraints constraints)
@@ -118,9 +81,9 @@
void Luna::dataUpdated(const QString& source, const Plasma::DataEngine::Data &data)
{
Q_UNUSED(source)
- Q_UNUSED(data)
- updateStatus();
+ QDateTime dt(data["Date"].toDate(), data["Time"].toTime());
+ calcStatus(dt.toTime_t());
}
void Luna::showConfigurationInterface()
@@ -176,7 +139,7 @@
void Luna::calcStatus(time_t time)
{
- Plasma::ToolTipData::ToolTipData toolTipData = \
Plasma::ToolTipData::ToolTipData(); + Plasma::ToolTipData::ToolTipData \
toolTipData;
uint lun = 0;
time_t last_new = 0;
Index: luna.h
===================================================================
--- luna.h (revision 774605)
+++ luna.h (working copy)
@@ -35,8 +35,6 @@
~Luna();
void init();
- Qt::Orientations expandingDirections() const;
- QSizeF contentSizeHint() const;
void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem \
*option, const QRect& contentsRect); void constraintsUpdated(Plasma::Constraints \
constraints);
@@ -49,8 +47,6 @@
private:
void connectToEngine();
-
- void updateStatus();
void calcStatus(time_t time);
int counter;
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic