From kde-core-devel Wed Feb 13 17:06:33 2008 From: "Aaron J. Seigo" Date: Wed, 13 Feb 2008 17:06:33 +0000 To: kde-core-devel Subject: Re: luna in kdereview, proposed move into extragear Message-Id: <200802131006.34499.aseigo () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=120292235921847 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart2887586.KUM2FKoFYc" --nextPart2887586.KUM2FKoFYc Content-Type: multipart/mixed; boundary="Boundary-01=_aOysHfLBUiPBeiu" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_aOysHfLBUiPBeiu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Wednesday 13 February 2008, Davide Bettio wrote: > I just moved luna plasma applet to kdereview. great =3D) i see you put it in kdreview/ itself; i've moved it into=20 kdreview/plasma/applets with the other applets under review. comments: * you could connect to the UTC data source of the Time DataEngine and avoid= =20 updateStatus() altogether. you get both the time and the date there, and=20 QDateTime provides a toTime_t. * where is it actually updating the contents? i don't see anything connecte= d=20 to updateStatus(), and connectToEngine() isn't called anywhere? replace the= =20 call to updateStatus() in init() with a call to connectToEngine and things= =20 are happy (just tried) * i wonder if the painting might look better at different if the moon image= s=20 were a bit bigger in the svg itself and you called=20 m_theme->resize(contentSize()) in constraintsUpdated when the SizeConstrain= t=20 is passed in * you shouldn't need to call updateGeometry in constraintsUpdated (if you d= o,=20 there's a bug somewhere in libplasma =3D) * you don't need that contentSizeHint there, or expandingDirections. just c= all=20 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. =2D-=20 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 --Boundary-01=_aOysHfLBUiPBeiu Content-Type: text/x-diff; charset="us-ascii"; name="luna.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="luna.diff" Index: luna.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- luna.cpp (revision 774605) +++ luna.cpp (working copy) @@ -38,6 +38,7 @@ m_dialog(0) { setHasConfigurationInterface(true); + setRemainSquare(true); resize(QSize(128, 128)); =20 counter =3D -1; @@ -57,56 +58,18 @@ =20 northHemisphere =3D cg.readEntry("northHemisphere", true); =20 =2D updateStatus(); + connectToEngine(); } =20 =2Dvoid Luna::updateStatus() =2D{ =2D struct tm * t; =2D time_t clock; =2D =2D time(&clock); =2D t =3D gmtime(&clock); =2D =2D calcStatus(mktime(t)); =2D} =2D Luna::~Luna() { =20 } =20 =2DQt::Orientations Luna::expandingDirections() const =2D{ =2D return 0; =2D} =2D =2DQSizeF Luna::contentSizeHint() const =2D{ =2D QSizeF sizeHint =3D contentSize(); =2D =2D switch (formFactor()) { =2D case Plasma::Vertical: =2D sizeHint.setHeight(sizeHint.width()); =2D break; =2D =2D case Plasma::Horizontal: =2D sizeHint.setWidth(sizeHint.height()); =2D break; =2D =2D default: =2D sizeHint.setWidth(sizeHint.height()); =2D break; =2D } =2D =2D return sizeHint; =2D} =2D void Luna::connectToEngine() { Plasma::DataEngine* timeEngine =3D dataEngine("time"); =2D =2D timeEngine->connectSource("Local", this, 360000, Plasma::AlignToHour= ); + timeEngine->connectSource("UTC", this, 360000, Plasma::AlignToHour); } =20 void Luna::constraintsUpdated(Plasma::Constraints constraints) @@ -118,9 +81,9 @@ void Luna::dataUpdated(const QString& source, const Plasma::DataEngine::Da= ta &data) { Q_UNUSED(source) =2D Q_UNUSED(data) =20 =2D updateStatus(); + QDateTime dt(data["Date"].toDate(), data["Time"].toTime()); + calcStatus(dt.toTime_t()); } =20 void Luna::showConfigurationInterface() @@ -176,7 +139,7 @@ =20 void Luna::calcStatus(time_t time) { =2D Plasma::ToolTipData::ToolTipData toolTipData =3D Plasma::ToolTipData= ::ToolTipData(); + Plasma::ToolTipData::ToolTipData toolTipData; =20 uint lun =3D 0; time_t last_new =3D 0; Index: luna.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- luna.h (revision 774605) +++ luna.h (working copy) @@ -35,8 +35,6 @@ ~Luna(); =20 void init(); =2D Qt::Orientations expandingDirections() const; =2D QSizeF contentSizeHint() const; void paintInterface(QPainter *painter, const QStyleOptionGraphicsI= tem *option, const QRect& contentsRect); void constraintsUpdated(Plasma::Constraints constraints); =20 @@ -49,8 +47,6 @@ =20 private: void connectToEngine(); =2D =2D void updateStatus(); void calcStatus(time_t time); =20 int counter; --Boundary-01=_aOysHfLBUiPBeiu-- --nextPart2887586.KUM2FKoFYc Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) iD8DBQBHsyOa1rcusafx20MRAvniAJ0RTrViOIlnGT/X/1Ig+W9jPTUbWQCeOw/Z rNEkfYYbPlf1r+McNzYB8fI= =C56R -----END PGP SIGNATURE----- --nextPart2887586.KUM2FKoFYc--