diff options
author | Timothy Pearson <[email protected]> | 2013-01-26 13:18:13 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-01-26 13:18:13 -0600 |
commit | 2fb700f92bb787fab0845a63a541cd5640daa449 (patch) | |
tree | c6f769db55585dd47a9fd415a40ee8b86926f683 /languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp | |
parent | fd1d1e1064eb09ddbbd67d3597c39856f5c0bc76 (diff) | |
download | tdevelop-2fb700f92bb787fab0845a63a541cd5640daa449.tar.gz tdevelop-2fb700f92bb787fab0845a63a541cd5640daa449.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp')
-rw-r--r-- | languages/cpp/app_templates/tdescreensaver/tdescreensaver.cpp | 107 |
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(); +} |