summaryrefslogtreecommitdiffstats
path: root/languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp
blob: 0d2bf1ff9db2a208a03abc3d7ef11fd8d645d60d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
%{CPP_TEMPLATE}

#include <stdlib.h>
#include <tqcheckbox.h>
#include <tqcolor.h>
#include <tdeapplication.h>
#include <tdelocale.h>
#include <kpushbutton.h>
#include <tdeconfig.h>
#include <tdeglobal.h>
#include "%{APPNAMELC}.h"
#include "%{APPNAMELC}ui.h"

//! libtdescreensaver interface
extern "C"
{
    const char *kss_applicationName = "%{APPNAMELC}.kss";
    const char *kss_description = I18N_NOOP( "%{APPNAME}" );
    const char *kss_version = "2.2.0";

    %{APPNAME} *kss_create( WId id )
    {
        TDEGlobal::locale()->insertCatalogue("%{APPNAMELC}");
        return new %{APPNAME}( id );
    }

    TQDialog *kss_setup()
    {
        TDEGlobal::locale()->insertCatalogue("%{APPNAMELC}");
        return new %{APPNAME}Setup();
    }
}

//-----------------------------------------------------------------------------
//! dialog to setup screen saver parameters
%{APPNAME}Setup::%{APPNAME}Setup( TQWidget *parent, const char *name )
        : %{APPNAME}UI( parent, name, TRUE )
{
    /// @todo
    //Connect your signals and slots here to configure the screen saver.
    connect( OkayPushButton, TQT_SIGNAL( released() ),
             TQT_SLOT( slotOkPressed() ) );
    connect( CancelPushButton, TQT_SIGNAL( released() ),
             TQT_SLOT( slotCancelPressed() ) );
}


//! read settings from config file
void %{APPNAME}Setup::readSettings()
{
    TDEConfig *config = TDEGlobal::config();
    config->setGroup( "Settings" );
    /// @todo
    // Add your config options here...
    CheckBox1->setChecked(config->readBoolEntry( "somesetting", false ));
}


//! Ok pressed - save settings and exit
void %{APPNAME}Setup::slotOkPressed()
{
    TDEConfig *config = TDEGlobal::config();
    config->setGroup( "Settings" );
    /// @todo
    // Add your config options here.
    config->writeEntry( "somesetting", CheckBox1->isChecked() );
    config->sync();

    accept();
}

void %{APPNAME}Setup::slotCancelPressed()
{
    reject();
}
//-----------------------------------------------------------------------------


%{APPNAME}::%{APPNAME}( WId id ) : KScreenSaver( id )
{
    readSettings();
    blank();
}

%{APPNAME}::~%{APPNAME}()
{}


//! read configuration settings from config file
void %{APPNAME}::readSettings()
{
    TDEConfig *config = TDEGlobal::config();
    config->setGroup( "Settings" );
    /// @todo
    // Add your config options here...
    bool somesetting = config->readBoolEntry( "somesetting", false );
}


void %{APPNAME}::blank()
{
    /// @todo
    //Add your code to render the screen.
    setBackgroundColor( TQColor(black)  );
    //
    erase();
}