Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 98 lines (81 sloc) 2.546 kb
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
1
2 #include "rtm.h"
3 #include <QPainter>
4 #include <QFontMetrics>
5 #include <QSizeF>
72f375ce »
2008-09-03 Create classes to implement RTM API, show something in the plasmoid. …
6 #include <QPushButton>
7 #include <QGraphicsLinearLayout>
8
9 #include <KUrlLabel>
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
10
11 #include <plasma/svg.h>
12 #include <plasma/theme.h>
72f375ce »
2008-09-03 Create classes to implement RTM API, show something in the plasmoid. …
13 #include <Plasma/PushButton>
14 #include <Plasma/Label>
a774540e »
2008-09-02 compile! at last!
15
16 #include "rtmapi.h"
17 // #include "rtm/rtmapi.c"
18
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
19 Rtm::Rtm(QObject *parent, const QVariantList &args)
20 : Plasma::Applet(parent, args),
21 m_svg(this),
72f375ce »
2008-09-03 Create classes to implement RTM API, show something in the plasmoid. …
22 m_icon("plasma"),
23 m_label(0),
24 m_authButton(0),
25 m_layout(0)
f3c3dcc1 »
2008-09-04 Try to add an ui file and display it, and expose many fun bugs everyw…
26 // m_ui(0)
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
27 {
72f375ce »
2008-09-03 Create classes to implement RTM API, show something in the plasmoid. …
28 m_layout = new QGraphicsLinearLayout(Qt::Vertical, this);
29
f3c3dcc1 »
2008-09-04 Try to add an ui file and display it, and expose many fun bugs everyw…
30 w = new QWidget();
31 QGraphicsProxyWidget *p = new QGraphicsProxyWidget(this);
32 p->setWidget(w);
33 m_ui = new Ui::MainWidget;
34 m_ui->setupUi(w);
35 m_layout->addItem(p);
36
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
37 // this will get us the standard applet background, for free!
38 setBackgroundHints(Plasma::Applet::StandardBackground);
39 resize(200, 200);
72f375ce »
2008-09-03 Create classes to implement RTM API, show something in the plasmoid. …
40
41 setLayout(m_layout);
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
42 }
43
44
45 Rtm::~Rtm()
46 {
f3c3dcc1 »
2008-09-04 Try to add an ui file and display it, and expose many fun bugs everyw…
47 delete w;
48 delete m_ui;
49 // delete m_label;
50 // delete m_authButton;
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
51 if (hasFailedToLaunch()) {
52 // Do some cleanup here
53 } else {
54 // Save settings
55 }
56 }
57
58 void Rtm::init()
59 {
f3c3dcc1 »
2008-09-04 Try to add an ui file and display it, and expose many fun bugs everyw…
60 // RtmApi rtm("4375efc5a88a6917485c7864736d5eef", "68fc073a483defd7");
61 // m_label = new Plasma::Label();
62 // m_label->setText("<qt><a href="+rtm.getAuthUrl()+"+>Authenticate!</a></qt>");
72f375ce »
2008-09-03 Create classes to implement RTM API, show something in the plasmoid. …
63 // m_label->setText("Authenticate!");
64
f3c3dcc1 »
2008-09-04 Try to add an ui file and display it, and expose many fun bugs everyw…
65 // m_authButton = new Plasma::PushButton(this);
66 // m_authButton->setText("I authenticated... continue");
72f375ce »
2008-09-03 Create classes to implement RTM API, show something in the plasmoid. …
67
f3c3dcc1 »
2008-09-04 Try to add an ui file and display it, and expose many fun bugs everyw…
68 // m_layout->addItem(m_label);
69 // m_layout->addItem(m_authButton);
a774540e »
2008-09-02 compile! at last!
70
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
71 // A small demonstration of the setFailedToLaunch function
72 if (m_icon.isNull()) {
73 setFailedToLaunch(true, "No world to say hello");
74 }
75 }
f3c3dcc1 »
2008-09-04 Try to add an ui file and display it, and expose many fun bugs everyw…
76
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
77
78 void Rtm::paintInterface(QPainter *p,
79 const QStyleOptionGraphicsItem *option, const QRect &contentsRect)
80 {
f3c3dcc1 »
2008-09-04 Try to add an ui file and display it, and expose many fun bugs everyw…
81 // p->setRenderHint(QPainter::SmoothPixmapTransform);
82 // p->setRenderHint(QPainter::Antialiasing);
83 //
84 // // Now we draw the applet, starting with our svg
85 // m_svg.resize((int)contentsRect.width(), (int)contentsRect.height());
86 // m_svg.paint(p, (int)contentsRect.left(), (int)contentsRect.top());
87 //
88 // // We place the icon and text
89 // p->drawPixmap(7, 0, m_icon.pixmap((int)contentsRect.width(),(int)contentsRect.width()-14));
90 // p->save();
91 // p->setPen(Qt::white);
92 // p->drawText(contentsRect,
93 // Qt::AlignBottom | Qt::AlignHCenter,
94 // m_a);
95 // p->restore();
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
96 }
f3c3dcc1 »
2008-09-04 Try to add an ui file and display it, and expose many fun bugs everyw…
97
461b1111 »
2008-09-02 Skema generated files for a RTM plasmoid
98 #include "rtm.moc"
Something went wrong with that request. Please try again.