Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 95a8294..6f57a7f 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Wellenreiter II. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -34,12 +34,13 @@ | |||
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qstatusbar.h> | 36 | #include <qstatusbar.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qtextstream.h> | 38 | #include <qtextstream.h> |
39 | #include <qtoolbutton.h> | 39 | #include <qtoolbutton.h> |
40 | #include <qwhatsthis.h> | ||
40 | 41 | ||
41 | #ifdef QWS | 42 | #ifdef QWS |
42 | #include <qpe/resource.h> | 43 | #include <qpe/resource.h> |
43 | #include <opie2/ofiledialog.h> | 44 | #include <opie2/ofiledialog.h> |
44 | using namespace Opie; | 45 | using namespace Opie; |
45 | #else | 46 | #else |
@@ -57,43 +58,47 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
57 | mw = new Wellenreiter( this ); | 58 | mw = new Wellenreiter( this ); |
58 | mw->setConfigWindow( cw ); | 59 | mw->setConfigWindow( cw ); |
59 | setCentralWidget( mw ); | 60 | setCentralWidget( mw ); |
60 | 61 | ||
61 | // setup application icon | 62 | // setup application icon |
62 | 63 | ||
63 | #ifndef QWS | ||
64 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 64 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
65 | #ifndef QWS | ||
65 | setIconText( "Wellenreiter/X11" ); | 66 | setIconText( "Wellenreiter/X11" ); |
66 | #endif | 67 | #endif |
67 | 68 | ||
68 | // setup tool buttons | 69 | // setup tool buttons |
69 | 70 | ||
70 | startButton = new QToolButton( 0 ); | 71 | startButton = new QToolButton( 0 ); |
72 | QWhatsThis::add( startButton, tr( "Click here to start scanning." ) ); | ||
71 | #ifdef QWS | 73 | #ifdef QWS |
72 | startButton->setAutoRaise( true ); | 74 | startButton->setAutoRaise( true ); |
73 | #endif | 75 | #endif |
74 | startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); | 76 | startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); |
75 | startButton->setEnabled( false ); | 77 | startButton->setEnabled( false ); |
76 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); | 78 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); |
77 | 79 | ||
78 | stopButton = new QToolButton( 0 ); | 80 | stopButton = new QToolButton( 0 ); |
81 | QWhatsThis::add( stopButton, tr( "Click here to stop scanning." ) ); | ||
79 | #ifdef QWS | 82 | #ifdef QWS |
80 | stopButton->setAutoRaise( true ); | 83 | stopButton->setAutoRaise( true ); |
81 | #endif | 84 | #endif |
82 | stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); | 85 | stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); |
83 | stopButton->setEnabled( false ); | 86 | stopButton->setEnabled( false ); |
84 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); | 87 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); |
85 | 88 | ||
86 | QToolButton* d = new QToolButton( 0 ); | 89 | QToolButton* d = new QToolButton( 0 ); |
90 | QWhatsThis::add( d, tr( "Click here to open the configure dialog." ) ), | ||
87 | #ifdef QWS | 91 | #ifdef QWS |
88 | d->setAutoRaise( true ); | 92 | d->setAutoRaise( true ); |
89 | #endif | 93 | #endif |
90 | d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); | 94 | d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); |
91 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 95 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
92 | 96 | ||
93 | uploadButton = new QToolButton( 0 ); | 97 | uploadButton = new QToolButton( 0 ); |
98 | QWhatsThis::add( uploadButton, tr( "Click here to upload a capture session." ) ); | ||
94 | #ifdef QWS | 99 | #ifdef QWS |
95 | uploadButton->setAutoRaise( true ); | 100 | uploadButton->setAutoRaise( true ); |
96 | #endif | 101 | #endif |
97 | uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); | 102 | uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); |
98 | uploadButton->setEnabled( false ); | 103 | uploadButton->setEnabled( false ); |
99 | //uploadButton->setEnabled( true ); // DEBUGGING | 104 | //uploadButton->setEnabled( true ); // DEBUGGING |
@@ -120,30 +125,33 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
120 | file->insertItem( tr( "&Save" ), fileSave ); | 125 | file->insertItem( tr( "&Save" ), fileSave ); |
121 | file->insertSeparator(); | 126 | file->insertSeparator(); |
122 | uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); | 127 | uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); |
123 | file->insertSeparator(); | 128 | file->insertSeparator(); |
124 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); | 129 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); |
125 | 130 | ||
126 | QPopupMenu* view = new QPopupMenu( mb ); | ||
127 | view->insertItem( tr( "&Configure..." ) ); | ||
128 | |||
129 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 131 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
130 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); | 132 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); |
131 | sniffer->insertSeparator(); | 133 | sniffer->insertSeparator(); |
132 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); | 134 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); |
133 | sniffer->setItemEnabled( startID, false ); | 135 | sniffer->setItemEnabled( startID, false ); |
134 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); | 136 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); |
135 | sniffer->setItemEnabled( stopID, false ); | 137 | sniffer->setItemEnabled( stopID, false ); |
136 | 138 | ||
139 | QPopupMenu* view = new QPopupMenu( mb ); | ||
140 | view->insertItem( tr( "&Expand All" ), this, SLOT( viewExpandAll() ) ); | ||
141 | view->insertItem( tr( "&Collapse All" ), this, SLOT( viewCollapseAll() ) ); | ||
142 | |||
137 | QPopupMenu* demo = new QPopupMenu( mb ); | 143 | QPopupMenu* demo = new QPopupMenu( mb ); |
138 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); | 144 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); |
139 | //demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) ); | 145 | //demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) ); |
140 | 146 | ||
141 | id = mb->insertItem( tr( "&File" ), file ); | 147 | id = mb->insertItem( tr( "&File" ), file ); |
142 | //id = mb->insertItem( tr( "&View" ), view ); | 148 | |
149 | id = mb->insertItem( tr( "&View" ), view ); | ||
143 | //mb->setItemEnabled( id, false ); | 150 | //mb->setItemEnabled( id, false ); |
151 | |||
144 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); | 152 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); |
145 | 153 | ||
146 | id = mb->insertItem( tr( "&Demo" ), demo ); | 154 | id = mb->insertItem( tr( "&Demo" ), demo ); |
147 | mb->setItemEnabled( id, true ); | 155 | mb->setItemEnabled( id, true ); |
148 | mb->setItemEnabled( uploadID, false ); | 156 | mb->setItemEnabled( uploadID, false ); |
149 | 157 | ||
@@ -550,6 +558,16 @@ void WellenreiterMainWindow::uploadSession() | |||
550 | QString ( "<p>%1</p>" ).arg( tr( "Capture Dump was uploaded to %1" ) ).arg( CAP_hostname ) ); | 558 | QString ( "<p>%1</p>" ).arg( tr( "Capture Dump was uploaded to %1" ) ).arg( CAP_hostname ) ); |
551 | else | 559 | else |
552 | QMessageBox::warning( 0, tr( "Error" ), | 560 | QMessageBox::warning( 0, tr( "Error" ), |
553 | QString ( "<p>%1</p>" ).arg ( tr( "Connection to %1 failed" ) ).arg( CAP_hostname ) ); | 561 | QString ( "<p>%1</p>" ).arg ( tr( "Connection to %1 failed" ) ).arg( CAP_hostname ) ); |
554 | } | 562 | } |
555 | 563 | ||
564 | |||
565 | void WellenreiterMainWindow::viewExpandAll() | ||
566 | { | ||
567 | mw->netView()->expand(); | ||
568 | } | ||
569 | |||
570 | void WellenreiterMainWindow::viewCollapseAll() | ||
571 | { | ||
572 | mw->netView()->collapse(); | ||
573 | } | ||