summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/blankscrn.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-01-26 13:16:20 -0600
committerTimothy Pearson <[email protected]>2013-01-26 13:16:20 -0600
commitdc6b76cac424bdf8b3cffb4ae82f3954d8acdba5 (patch)
tree4ebcd3dac0133d8d3fa880bbf83692c305b7350d /tdescreensaver/blankscrn.cpp
parent1a9478c6e1b77b05814af8fa02cd563a5da8946b (diff)
downloadtdebase-dc6b76cac424bdf8b3cffb4ae82f3954d8acdba5.tar.gz
tdebase-dc6b76cac424bdf8b3cffb4ae82f3954d8acdba5.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdescreensaver/blankscrn.cpp')
-rw-r--r--tdescreensaver/blankscrn.cpp135
1 files changed, 135 insertions, 0 deletions
diff --git a/tdescreensaver/blankscrn.cpp b/tdescreensaver/blankscrn.cpp
new file mode 100644
index 000000000..e2c6ed889
--- /dev/null
+++ b/tdescreensaver/blankscrn.cpp
@@ -0,0 +1,135 @@
+//-----------------------------------------------------------------------------
+//
+// kblankscrn - Basic screen saver for KDE
+//
+// Copyright (c) Martin R. Jones 1996
+//
+// 1998/04/19 Layout management added by Mario Weilguni <[email protected]>
+// 2001/03/04 Converted to use libtdescreensaver by Martin R. Jones
+
+#include <stdlib.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <kconfig.h>
+#include <kcolordialog.h>
+#include <kbuttonbox.h>
+#include <kcolorbutton.h>
+#include <kglobal.h>
+#include "blankscrn.h"
+#include "blankscrn.moc"
+
+// libtdescreensaver interface
+extern "C"
+{
+ KDE_EXPORT const char *kss_applicationName = "kblankscrn.kss";
+ KDE_EXPORT const char *kss_description = I18N_NOOP( "KBlankScreen" );
+ KDE_EXPORT const char *kss_version = "2.2.0";
+
+ KDE_EXPORT KScreenSaver* kss_create( WId id )
+ {
+ return new KBlankSaver( id );
+ }
+
+ KDE_EXPORT TQDialog* kss_setup()
+ {
+ return new KBlankSetup();
+ }
+}
+
+//-----------------------------------------------------------------------------
+// dialog to setup screen saver parameters
+//
+KBlankSetup::KBlankSetup( TQWidget *parent, const char *name )
+ : KDialogBase( parent, name, true, i18n( "Setup Blank Screen Saver" ),
+ Ok|Cancel, Ok, true )
+{
+ readSettings();
+
+ TQFrame *main = makeMainWidget();
+ TQGridLayout *grid = new TQGridLayout(main, 4, 2, 0, spacingHint() );
+
+ TQLabel *label = new TQLabel( i18n("Color:"), main );
+ grid->addWidget(label, 0, 0);
+
+ KColorButton *colorPush = new KColorButton( color, main );
+ colorPush->setMinimumWidth(80);
+ connect( colorPush, TQT_SIGNAL( changed(const TQColor &) ),
+ TQT_SLOT( slotColor(const TQColor &) ) );
+ grid->addWidget(colorPush, 1, 0);
+
+ preview = new TQWidget( main );
+ preview->setFixedSize( 220, 165 );
+ preview->setBackgroundColor( black );
+ preview->show(); // otherwise saver does not get correct size
+ saver = new KBlankSaver( preview->winId() );
+ grid->addMultiCellWidget(preview, 0, 2, 1, 1);
+
+ grid->setRowStretch( 2, 10 );
+ grid->setRowStretch( 3, 20 );
+
+ setMinimumSize( sizeHint() );
+}
+
+// read settings from config file
+void KBlankSetup::readSettings()
+{
+ TDEConfig *config = TDEGlobal::config();
+ config->setGroup( "Settings" );
+
+ color = config->readColorEntry( "Color", &black );
+}
+
+void KBlankSetup::slotColor( const TQColor &col )
+{
+ color = col;
+ saver->setColor( color );
+}
+
+// Ok pressed - save settings and exit
+void KBlankSetup::slotOk()
+{
+ TDEConfig *config = TDEGlobal::config();
+ config->setGroup( "Settings" );
+ config->writeEntry( "Color", color );
+ config->sync();
+
+ accept();
+}
+
+//-----------------------------------------------------------------------------
+
+
+KBlankSaver::KBlankSaver( WId id ) : KScreenSaver( id )
+{
+ readSettings();
+ blank();
+}
+
+KBlankSaver::~KBlankSaver()
+{
+}
+
+// set the color
+void KBlankSaver::setColor( const TQColor &col )
+{
+ color = col;
+ blank();
+}
+
+// read configuration settings from config file
+void KBlankSaver::readSettings()
+{
+ TDEConfig *config = TDEGlobal::config();
+ config->setGroup( "Settings" );
+
+ color = config->readColorEntry( "Color", &black );
+}
+
+void KBlankSaver::blank()
+{
+ setBackgroundColor( color );
+ erase();
+}
+