From 5ea0c300dd32f5b9f1879c36adb5c37ad0c19b4f Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Wed, 23 Sep 2009 16:27:25 +0200 Subject: These tweaks are bogus. Revert "various devdays tweak" This reverts commit 80fd32a99dc0dfd94611852b0fc6d1523a6e6885. --- digiflip/digiflip.cpp | 100 ++++++-------------------------------------- lightmaps/lightmaps.cpp | 16 +------ weatherinfo/weatherinfo.cpp | 6 +-- 3 files changed, 14 insertions(+), 108 deletions(-) diff --git a/digiflip/digiflip.cpp b/digiflip/digiflip.cpp index 2d9375d..7a4b362 100644 --- a/digiflip/digiflip.cpp +++ b/digiflip/digiflip.cpp @@ -30,8 +30,6 @@ class Digits: public QWidget public: - int m_number; - enum { Slide, Flip, @@ -41,13 +39,13 @@ public: Digits(QWidget *parent) : QWidget(parent) , m_number(0) - , m_transition(Flip) + , m_transition(Slide) { setAttribute(Qt::WA_OpaquePaintEvent, true); setAttribute(Qt::WA_NoSystemBackground, true); connect(&m_animator, SIGNAL(frameChanged(int)), SLOT(update())); m_animator.setFrameRange(0, 100); - m_animator.setDuration(6000); + m_animator.setDuration(600); m_animator.setCurveShape(QTimeLine::EaseInOutCurve); } @@ -144,8 +142,6 @@ protected: p.begin(&m_pixmap); p.drawPixmap(0, 0, drawDigits(m_number, rect())); p.end(); - m_pixmap.save("pixmap.png"); - } void resizeEvent(QResizeEvent*) { @@ -160,15 +156,6 @@ protected: int pad = width() / 10; drawFrame(&p, rect().adjusted(pad, pad, -pad, -pad)); p.drawPixmap(0, 0, m_pixmap); - p.end(); - - QPixmap bla(rect().size()); - bla.fill(Qt::transparent); - p.begin(&bla); - drawFrame(&p, rect().adjusted(pad, pad, -pad, -pad)); - p.drawPixmap(0, 0, m_pixmap); - p.end(); - bla.save("frame.png"); } void paintSlide() { @@ -183,45 +170,15 @@ protected: int y = height() * m_animator.currentFrame() / 100; p.drawPixmap(0, y, m_lastPixmap); p.drawPixmap(0, y - height(), m_pixmap); - p.end(); - - QPixmap bla(rect().size()); - bla.fill(Qt::transparent); - p.begin(&bla); - drawFrame(&p, fr); - p.setClipRect(fr); - p.drawPixmap(0, y, m_lastPixmap); - p.drawPixmap(0, y - height(), m_pixmap); - p.end(); - qDebug() << m_animator.currentFrame(); - if (y < 85) { - bla.save("digiflip_slide1.png"); - } - if (y < 25) { - bla.save("digiflip_slide2.png"); - } } - void paintFlip() { QPainter p(this); - paintFlip(p); - p.end(); - QPixmap pixmap(size()); - pixmap.fill(Qt::transparent); - p.begin(&pixmap); - paintFlip(p); - p.end(); - if (m_animator.currentFrame() < 30) - pixmap.save("digiflip_flip1.png"); - if (m_animator.currentFrame() < 70) - pixmap.save("digiflip_flip2.png"); - } - - void paintFlip(QPainter &p) { - p.setRenderHint(QPainter::SmoothPixmapTransform, false); - p.setRenderHint(QPainter::Antialiasing, false); - //p.fillRect(rect(), Qt::black); +#if !defined(Q_OS_SYMBIAN) + p.setRenderHint(QPainter::SmoothPixmapTransform, true); + p.setRenderHint(QPainter::Antialiasing, true); +#endif + p.fillRect(rect(), Qt::black); int hw = width() / 2; int hh = height() / 2; @@ -268,6 +225,7 @@ protected: p.drawPixmap(-hw, -hh, m_pixmap); } + } void paintRotate() { @@ -290,39 +248,6 @@ protected: p.setTransform(transform); p.setRenderHint(QPainter::SmoothPixmapTransform, true); p.drawPixmap(-width() / 2, -height() / 2, pix); - p.end(); - - - QPixmap bla(rect().size()); - bla.fill(Qt::transparent); - p.begin(&bla); - { - int pad = width() / 10; - QRect fr = rect().adjusted(pad, pad, -pad, -pad); - drawFrame(&p, fr); - p.setClipRect(fr); - - int angle1 = -180 * m_animator.currentFrame() / 100; - int angle2 = 180 - 180 * m_animator.currentFrame() / 100; - int angle = (m_animator.currentFrame() <= 50) ? angle1 : angle2; - QPixmap pix = (m_animator.currentFrame() <= 50) ? m_lastPixmap : m_pixmap; - - QTransform transform; - transform.translate(width() / 2, height() / 2); - transform.rotate(angle, Qt::XAxis); - - p.setTransform(transform); - p.setRenderHint(QPainter::SmoothPixmapTransform, true); - p.drawPixmap(-width() / 2, -height() / 2, pix); - p.end(); - - if (m_animator.currentFrame() < 1) { - bla.save("digiflip_rotate1.png"); - } - if (m_animator.currentFrame() < 40) { - bla.save("digiflip_rotate2.png"); - } - } } void paintEvent(QPaintEvent *event) { @@ -340,6 +265,7 @@ protected: } private: + int m_number; int m_transition; QPixmap m_pixmap; QPixmap m_lastPixmap; @@ -363,12 +289,10 @@ public: pal.setColor(QPalette::Window, Qt::black); setPalette(pal); - m_ticker.start(13000, this); + m_ticker.start(1000, this); QTime t = QTime::currentTime(); m_hour->setNumber(t.hour()); m_minute->setNumber(t.minute()); - m_hour->setNumber(13); - m_minute->setNumber(36-1); updateTime(); QAction *slideAction = new QAction("&Slide", this); @@ -391,8 +315,8 @@ public: void updateTime() { QTime t = QTime::currentTime(); - m_hour->flipTo(13); - m_minute->flipTo(m_minute->m_number + 1); + m_hour->flipTo(t.hour()); + m_minute->flipTo(t.minute()); QString str = t.toString("hh:mm:ss"); str.prepend(": "); if (m_hour->transition() == Digits::Slide) diff --git a/lightmaps/lightmaps.cpp b/lightmaps/lightmaps.cpp index d3ac1fa..bc9798c 100644 --- a/lightmaps/lightmaps.cpp +++ b/lightmaps/lightmaps.cpp @@ -145,16 +145,13 @@ public: } void render(QPainter *p, const QRect &rect) { - p->setPen(QPen(Qt::red, 2)); for (int x = 0; x <= m_tilesRect.width(); ++x) for (int y = 0; y <= m_tilesRect.height(); ++y) { QPoint tp(x + m_tilesRect.left(), y + m_tilesRect.top()); QRect box = tileRect(tp); if (rect.intersects(box)) { - if (m_tilePixmaps.contains(tp)) { + if (m_tilePixmaps.contains(tp)) p->drawPixmap(box, m_tilePixmaps.value(tp)); - p->drawRect(box.adjusted(0, 0, -2, -2)); - } else p->drawPixmap(box, m_emptyTile); } @@ -179,17 +176,6 @@ private slots: if (!img.load(reply, 0)) img = QImage(); reply->deleteLater(); -#if 0 - QPainter p(&img); - p.setPen(QPen(Qt::white, 1)); - p.setBrush(Qt::NoBrush); - p.drawRect(img.rect().adjusted(0, 0, -1, -1)); - p.fillRect(10, 10, 20, 20, Qt::red); - p.end(); - img.fill(qRgba(255, 0, 0, 255)); - img.save("bla.png"); -#endif - m_tilePixmaps[tp] = QPixmap::fromImage(img); if (img.isNull()) m_tilePixmaps[tp] = m_emptyTile; diff --git a/weatherinfo/weatherinfo.cpp b/weatherinfo/weatherinfo.cpp index 06b5c87..98f73c4 100644 --- a/weatherinfo/weatherinfo.cpp +++ b/weatherinfo/weatherinfo.cpp @@ -26,8 +26,6 @@ #include #include -#include - #if defined (Q_OS_SYMBIAN) #include "sym_iap_util.h" #endif @@ -231,8 +229,6 @@ private: void digest(const QString &data) { - std::cout << qPrintable(data); - QColor textColor = palette().color(QPalette::WindowText); QString unitSystem; @@ -489,7 +485,7 @@ int main(int argc, char *argv[]) #if defined(Q_OS_SYMBIAN) w.showMaximized(); #else - w.resize(300, 400); + w.resize(520, 288); w.show(); #endif -- cgit v1.2.3