1/*
2 * Copyright 2011 Jon Ander PeƱalba <jonan88@gmail.com>
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef KDEDEMO_H
27#define KDEDEMO_H
28
29#include <QtCore/QList>
30#include <Plasma/Applet>
31
32class QGraphicsGridLayout;
33
34namespace Plasma {
35class Label;
36class PushButton;
37}
38
39struct Category;
40struct Example;
41
42class KdeDemo : public Plasma::Applet
43{
44 Q_OBJECT
45
46 public:
47 KdeDemo(QObject *parent, const QVariantList &args);
48 ~KdeDemo();
49
50 void init();
51
52 Q_SIGNALS:
53 void hideCategories();
54 void showCategories();
55
56 private Q_SLOTS:
57 void loadExampleList();
58 void loadExample();
59 void backToCategories();
60 void openSourceCode();
61 void launchExample();
62
63 private:
64 void loadButtons(QList<Plasma::PushButton*> list, QString m_text);
65 void loadConfig();
66 void loadTextFromFile(QString tittle, QString file_name);
67
68 QList<Category> m_categories;
69 QList<Plasma::PushButton*> m_category_buttons, m_current_buttons;
70 QList< QList<Plasma::PushButton*> > m_example_buttons;
71 Plasma::PushButton *m_back_button, *m_quit_launch_button, *m_show_source_button;
72 Plasma::Label *m_text, *m_tittle;
73 QGraphicsGridLayout *m_layout;
74 Category *m_current_category;
75 Example *m_current_example;
76};
77
78#endif // KDEDEMO_H
79