From dfe289850f068f19ba4a83ab4e7e22a7e09c13c9 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:21 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- libtdescreensaver/main.cpp | 163 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 libtdescreensaver/main.cpp (limited to 'libtdescreensaver/main.cpp') diff --git a/libtdescreensaver/main.cpp b/libtdescreensaver/main.cpp new file mode 100644 index 000000000..9f908b81a --- /dev/null +++ b/libtdescreensaver/main.cpp @@ -0,0 +1,163 @@ +/* This file is part of the KDE libraries + + Copyright (c) 2001 Martin R. Jones + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "tdescreensaver.h" +#include "tdescreensaver_vroot.h" + +extern "C" +{ + extern const char *kss_applicationName; + extern const char *kss_description; + extern const char *kss_version; + KScreenSaver *kss_create( WId d ); + TQDialog *kss_setup(); +} + +static const KCmdLineOptions options[] = +{ + { "setup", I18N_NOOP("Setup screen saver"), 0 }, + { "window-id wid", I18N_NOOP("Run in the specified XWindow"), 0 }, + { "root", I18N_NOOP("Run in the root XWindow"), 0 }, + { "demo", I18N_NOOP("Start screen saver in demo mode"), "default"}, + KCmdLineLastOption +}; + +static void crashHandler( int ) +{ +#ifdef SIGABRT + signal (SIGABRT, SIG_DFL); +#endif + abort(); +} + +//---------------------------------------------------------------------------- + +class DemoWindow : public TQWidget +{ +public: + DemoWindow() : TQWidget() + { + setFixedSize(600, 420); + } + +protected: + virtual void keyPressEvent(TQKeyEvent *e) + { + if (e->ascii() == 'q') + { + kapp->quit(); + } + } + + virtual void closeEvent( TQCloseEvent * ) + { + kapp->quit(); + } +}; + + +//---------------------------------------------------------------------------- +#if defined(Q_WS_QWS) || defined(Q_WS_MACX) +typedef WId Window; +#endif + +KDE_EXPORT int main(int argc, char *argv[]) +{ + KLocale::setMainCatalogue("libtdescreensaver"); + TDECmdLineArgs::init(argc, argv, kss_applicationName, kss_description, kss_version); + + TDECmdLineArgs::addCmdLineOptions(options); + + TDEApplication app; + + KCrash::setCrashHandler( crashHandler ); + TDEGlobal::locale()->insertCatalogue("klock"); + TDEGlobal::locale()->insertCatalogue("tdescreensaver"); + + DemoWindow *demoWidget = 0; + Window saveWin = 0; + KScreenSaver *target; + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if (args->isSet("setup")) + { + TQDialog *dlg = kss_setup(); + args->clear(); + dlg->exec(); + delete dlg; + exit(0); + } + + if (args->isSet("window-id")) + { + saveWin = atol(args->getOption("window-id")); + } + +#ifdef Q_WS_X11 //FIXME + if (args->isSet("root")) + { + saveWin = RootWindow(tqt_xdisplay(), tqt_xscreen()); + } +#endif + + if (args->isSet("demo")) + { + saveWin = 0; + } + + if (saveWin == 0) + { + demoWidget = new DemoWindow(); + demoWidget->setBackgroundMode(TQWidget::NoBackground); + saveWin = demoWidget->winId(); + app.setMainWidget(demoWidget); + app.processEvents(); + } + + target = kss_create( saveWin ); + + if ( demoWidget ) + { + demoWidget->setFixedSize( 600, 420 ); + demoWidget->show(); + } + args->clear(); + app.exec(); + + delete target; + delete demoWidget; + + return 0; +} + -- cgit v1.2.1 From 59d153016be1e09cb31cdb18bef0a649acfc6292 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Feb 2013 08:17:52 -0600 Subject: Rename KLocale to enhance compatibility with KDE4 --- libtdescreensaver/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libtdescreensaver/main.cpp') diff --git a/libtdescreensaver/main.cpp b/libtdescreensaver/main.cpp index 9f908b81a..cd8e2d392 100644 --- a/libtdescreensaver/main.cpp +++ b/libtdescreensaver/main.cpp @@ -93,7 +93,7 @@ typedef WId Window; KDE_EXPORT int main(int argc, char *argv[]) { - KLocale::setMainCatalogue("libtdescreensaver"); + TDELocale::setMainCatalogue("libtdescreensaver"); TDECmdLineArgs::init(argc, argv, kss_applicationName, kss_description, kss_version); TDECmdLineArgs::addCmdLineOptions(options); -- cgit v1.2.1 From 4b3606f910373fb4b9d653049b6c08a809aebf47 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 5 Feb 2013 18:38:23 -0600 Subject: Rename KCrash to avoid conflicts with KDE4 --- libtdescreensaver/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libtdescreensaver/main.cpp') diff --git a/libtdescreensaver/main.cpp b/libtdescreensaver/main.cpp index cd8e2d392..50a61f938 100644 --- a/libtdescreensaver/main.cpp +++ b/libtdescreensaver/main.cpp @@ -100,7 +100,7 @@ KDE_EXPORT int main(int argc, char *argv[]) TDEApplication app; - KCrash::setCrashHandler( crashHandler ); + TDECrash::setCrashHandler( crashHandler ); TDEGlobal::locale()->insertCatalogue("klock"); TDEGlobal::locale()->insertCatalogue("tdescreensaver"); -- cgit v1.2.1 From 5466d52073af147d100482cbf633087bb9fb631b Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 6 Feb 2013 19:46:01 -0600 Subject: Rename KCmd to avoid conflicts with KDE4 --- libtdescreensaver/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libtdescreensaver/main.cpp') diff --git a/libtdescreensaver/main.cpp b/libtdescreensaver/main.cpp index 50a61f938..aa4fa8395 100644 --- a/libtdescreensaver/main.cpp +++ b/libtdescreensaver/main.cpp @@ -43,13 +43,13 @@ extern "C" TQDialog *kss_setup(); } -static const KCmdLineOptions options[] = +static const TDECmdLineOptions options[] = { { "setup", I18N_NOOP("Setup screen saver"), 0 }, { "window-id wid", I18N_NOOP("Run in the specified XWindow"), 0 }, { "root", I18N_NOOP("Run in the root XWindow"), 0 }, { "demo", I18N_NOOP("Start screen saver in demo mode"), "default"}, - KCmdLineLastOption + TDECmdLineLastOption }; static void crashHandler( int ) -- cgit v1.2.1 From 8bd62a3b0d3b362b783a273e2460811392485bbd Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 14 Feb 2013 17:17:18 -0600 Subject: Rename common header files for consistency with class renaming --- libtdescreensaver/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libtdescreensaver/main.cpp') diff --git a/libtdescreensaver/main.cpp b/libtdescreensaver/main.cpp index aa4fa8395..f9d8ccb17 100644 --- a/libtdescreensaver/main.cpp +++ b/libtdescreensaver/main.cpp @@ -27,8 +27,8 @@ #include #include #include -#include -#include +#include +#include #include #include "tdescreensaver.h" -- cgit v1.2.1 From ed99a30644c19b0a3cf0d2147243532df4daa16b Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 15 Feb 2013 21:57:54 -0600 Subject: Rename additional header files to avoid conflicts with KDE4 --- libtdescreensaver/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libtdescreensaver/main.cpp') diff --git a/libtdescreensaver/main.cpp b/libtdescreensaver/main.cpp index f9d8ccb17..073d7845d 100644 --- a/libtdescreensaver/main.cpp +++ b/libtdescreensaver/main.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include #include #include -- cgit v1.2.1