author | zcarsten <zcarsten> | 2003-07-22 19:23:13 (UTC) |
---|---|---|
committer | zcarsten <zcarsten> | 2003-07-22 19:23:13 (UTC) |
commit | fa3772aa7ddea5725cc7e7db42d017567e4cc14c (patch) (unidiff) | |
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 @@ | |||
1 | /* | ||
2 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> | ||
3 | ** | ||
4 | ** $Id$ | ||
5 | ** | ||
6 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html | ||
7 | */ | ||
8 | |||
9 | |||
10 | #include "zsafe.h" | ||
11 | #ifdef DESKTOP | ||
12 | #include <qapplication.h> | ||
13 | #else | ||
14 | #include <qpe/qpeapplication.h> | ||
15 | #endif | ||
16 | #include <stdio.h> | ||
17 | #include <signal.h> | ||
18 | #include "qsettings.h" | ||
19 | |||
20 | ZSafe *zs; | ||
21 | #ifdef DESKTOP | ||
22 | QApplication *appl; | ||
23 | #else | ||
24 | QPEApplication *appl; | ||
25 | #endif | ||
26 | |||
27 | int DeskW; | ||
28 | int DeskH; | ||
29 | |||
30 | void suspend (int signum) | ||
31 | { | ||
32 | printf ("Suspend signal %d received\n", signum); | ||
33 | } | ||
34 | |||
35 | void resume (int signum) | ||
36 | { | ||
37 | printf ("Resume signal %d received\n", signum); | ||
38 | zs->resume(signum); | ||
39 | } | ||
40 | |||
41 | int main( int argc, char ** argv ) | ||
42 | { | ||
43 | #ifndef WIN32 | ||
44 | // install signal handler | ||
45 | signal (SIGSTOP, suspend); | ||
46 | #endif | ||
47 | |||
48 | #ifdef DESKTOP | ||
49 | QApplication a( argc, argv ); | ||
50 | #else | ||
51 | QPEApplication a( argc, argv ); | ||
52 | #endif | ||
53 | appl = &a; | ||
54 | |||
55 | #ifdef DESKTOP | ||
56 | if (argc >= 3) | ||
57 | { | ||
58 | #ifndef WIN32 | ||
59 | DeskW = atoi(argv[1]); | ||
60 | DeskH = atoi(argv[2]); | ||
61 | #else | ||
62 | int w, h; | ||
63 | sscanf (argv[1], "%d", &w); | ||
64 | sscanf (argv[2], "%d", &h); | ||
65 | DeskW = w; | ||
66 | DeskH = h; | ||
67 | #endif | ||
68 | } | ||
69 | else | ||
70 | { | ||
71 | DeskW = 600; | ||
72 | DeskH = 400; | ||
73 | } | ||
74 | #else | ||
75 | DeskW = a.desktop()->width(); | ||
76 | DeskH = a.desktop()->height(); | ||
77 | |||
78 | char buf[128]; | ||
79 | sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH); | ||
80 | qWarning (buf); | ||
81 | if (DeskW > 240) | ||
82 | { | ||
83 | DeskW -= 20; | ||
84 | DeskH += 25; | ||
85 | sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH); | ||
86 | qWarning (buf); | ||
87 | } | ||
88 | #endif | ||
89 | |||
90 | ZSafe mw; | ||
91 | zs = &mw; | ||
92 | |||
93 | #ifndef WIN32 | ||
94 | signal (SIGCONT, resume); | ||
95 | #endif | ||
96 | #ifdef DESKTOP | ||
97 | a.setMainWidget(&mw); | ||
98 | mw.show(); | ||
99 | #else | ||
100 | // a.showMainWidget( &mw ); | ||
101 | a.showMainDocumentWidget( &mw ); | ||
102 | #endif | ||
103 | int ret = a.exec(); | ||
104 | |||
105 | return ret; | ||
106 | } | ||