summaryrefslogtreecommitdiffstats
path: root/languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp')
-rw-r--r--languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp107
1 files changed, 107 insertions, 0 deletions
diff --git a/languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp b/languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp
new file mode 100644
index 00000000..f8e88db8
--- /dev/null
+++ b/languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp
@@ -0,0 +1,107 @@
+%{CPP_TEMPLATE}
+
+#include <stdlib.h>
+#include <tqcheckbox.h>
+#include <tqcolor.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <kpushbutton.h>
+#include <kconfig.h>
+#include <kglobal.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();
+}