|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "publisherdialog.h" |
|
43 #include "subscriberdialog.h" |
|
44 |
|
45 #include <QApplication> |
|
46 |
|
47 #include <qvaluespace.h> |
|
48 |
|
49 int main(int argc, char *argv[]) |
|
50 { |
|
51 QApplication app(argc, argv); |
|
52 |
|
53 bool createDefault = true; |
|
54 bool createPublisher = false; |
|
55 bool createSubscriber = false; |
|
56 |
|
57 for (int i = 1; i < argc; ++i) { |
|
58 if (argv[i] == QLatin1String("-server")) { |
|
59 QValueSpace::initValueSpaceServer(); |
|
60 } else if (argv[i] == QLatin1String("-publisher")) { |
|
61 createPublisher = true; |
|
62 createDefault = false; |
|
63 } else if (argv[i] == QLatin1String("-subscriber")) { |
|
64 createSubscriber = true; |
|
65 createDefault = false; |
|
66 } |
|
67 } |
|
68 |
|
69 PublisherDialog *publisher = 0; |
|
70 if (createDefault || createPublisher) { |
|
71 publisher = new PublisherDialog; |
|
72 QObject::connect(publisher, SIGNAL(rejected()), &app, SLOT(quit())); |
|
73 #ifndef QTM_SMALL_SCREEN |
|
74 publisher->show(); |
|
75 #endif |
|
76 } |
|
77 |
|
78 SubscriberDialog *subscriber = 0; |
|
79 if (createDefault || createSubscriber) { |
|
80 subscriber = new SubscriberDialog; |
|
81 QObject::connect(subscriber, SIGNAL(rejected()), &app, SLOT(quit())); |
|
82 #ifndef QTM_SMALL_SCREEN |
|
83 subscriber->show(); |
|
84 #else |
|
85 subscriber->showMaximized(); |
|
86 #endif |
|
87 } |
|
88 |
|
89 #ifdef QTM_SMALL_SCREEN |
|
90 QObject::connect(publisher, SIGNAL(switchRequested()), subscriber, SLOT(showMaximized())); |
|
91 QObject::connect(publisher, SIGNAL(switchRequested()), subscriber, SLOT(repaint())); |
|
92 QObject::connect(publisher, SIGNAL(switchRequested()), publisher, SLOT(hide())); |
|
93 |
|
94 QObject::connect(subscriber, SIGNAL(switchRequested()), publisher, SLOT(showMaximized())); |
|
95 QObject::connect(subscriber, SIGNAL(switchRequested()), publisher, SLOT(repaint())); |
|
96 QObject::connect(subscriber, SIGNAL(switchRequested()), subscriber, SLOT(hide())); |
|
97 #endif |
|
98 |
|
99 int result = app.exec(); |
|
100 |
|
101 if (publisher) |
|
102 delete publisher; |
|
103 if (subscriber) |
|
104 delete subscriber; |
|
105 |
|
106 return result; |
|
107 } |