author | zcarsten <zcarsten> | 2003-07-22 19:23:13 (UTC) |
---|---|---|
committer | zcarsten <zcarsten> | 2003-07-22 19:23:13 (UTC) |
commit | fa3772aa7ddea5725cc7e7db42d017567e4cc14c (patch) (side-by-side diff) | |
tree | 112ec27dd148d0b381ac559fd3e1ee32a89ecd0d /noncore/apps/zsafe/main.cpp | |
parent | 059af0e82a14a32f068c2ad943dc918afca93587 (diff) | |
download | opie-fa3772aa7ddea5725cc7e7db42d017567e4cc14c.zip opie-fa3772aa7ddea5725cc7e7db42d017567e4cc14c.tar.gz opie-fa3772aa7ddea5725cc7e7db42d017567e4cc14c.tar.bz2 |
Initial revision
-rw-r--r-- | noncore/apps/zsafe/main.cpp | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp new file mode 100644 index 0000000..c6ef5f9 --- a/dev/null +++ b/noncore/apps/zsafe/main.cpp @@ -0,0 +1,106 @@ +/* +** Author: Carsten Schneider <CarstenSchneider@t-online.de> +** +** $Id$ +** +** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html +*/ + + +#include "zsafe.h" +#ifdef DESKTOP +#include <qapplication.h> +#else +#include <qpe/qpeapplication.h> +#endif +#include <stdio.h> +#include <signal.h> +#include "qsettings.h" + +ZSafe *zs; +#ifdef DESKTOP +QApplication *appl; +#else +QPEApplication *appl; +#endif + +int DeskW; +int DeskH; + +void suspend (int signum) +{ + printf ("Suspend signal %d received\n", signum); +} + +void resume (int signum) +{ + printf ("Resume signal %d received\n", signum); + zs->resume(signum); +} + +int main( int argc, char ** argv ) +{ +#ifndef WIN32 + // install signal handler + signal (SIGSTOP, suspend); +#endif + +#ifdef DESKTOP + QApplication a( argc, argv ); +#else + QPEApplication a( argc, argv ); +#endif + appl = &a; + +#ifdef DESKTOP + if (argc >= 3) + { +#ifndef WIN32 + DeskW = atoi(argv[1]); + DeskH = atoi(argv[2]); +#else + int w, h; + sscanf (argv[1], "%d", &w); + sscanf (argv[2], "%d", &h); + DeskW = w; + DeskH = h; +#endif + } + else + { + DeskW = 600; + DeskH = 400; + } +#else + DeskW = a.desktop()->width(); + DeskH = a.desktop()->height(); + + char buf[128]; + sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH); + qWarning (buf); + if (DeskW > 240) + { + DeskW -= 20; + DeskH += 25; + sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH); + qWarning (buf); + } +#endif + + ZSafe mw; + zs = &mw; + +#ifndef WIN32 + signal (SIGCONT, resume); +#endif +#ifdef DESKTOP + a.setMainWidget(&mw); + mw.show(); +#else + // a.showMainWidget( &mw ); + a.showMainDocumentWidget( &mw ); +#endif + int ret = a.exec(); + + return ret; +} |