-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 1 |
2 files changed, 14 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 0a58b6c..bfd1c2e 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,330 +1,338 @@ | |||
1 | 1 | ||
2 | #include <qaction.h> | 2 | #include <qaction.h> |
3 | #include <qmenubar.h> | 3 | #include <qmenubar.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qpopupmenu.h> | 5 | #include <qpopupmenu.h> |
6 | #include <qtoolbar.h> | 6 | #include <qtoolbar.h> |
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | #include <opie/ofiledialog.h> | 8 | #include <opie/ofiledialog.h> |
9 | 9 | ||
10 | #include "profileeditordialog.h" | 10 | #include "profileeditordialog.h" |
11 | #include "configdialog.h" | 11 | #include "configdialog.h" |
12 | #include "default.h" | 12 | #include "default.h" |
13 | #include "metafactory.h" | 13 | #include "metafactory.h" |
14 | #include "profile.h" | 14 | #include "profile.h" |
15 | #include "profilemanager.h" | 15 | #include "profilemanager.h" |
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #include "tabwidget.h" | 17 | #include "tabwidget.h" |
18 | #include "transferdialog.h" | 18 | #include "transferdialog.h" |
19 | #include "function_keyboard.h" | 19 | #include "function_keyboard.h" |
20 | #include "script.h" | 20 | #include "script.h" |
21 | 21 | ||
22 | MainWindow::MainWindow() { | 22 | MainWindow::MainWindow() { |
23 | m_factory = new MetaFactory(); | 23 | m_factory = new MetaFactory(); |
24 | Default def(m_factory); | 24 | Default def(m_factory); |
25 | m_sessions.setAutoDelete( TRUE ); | 25 | m_sessions.setAutoDelete( TRUE ); |
26 | m_curSession = 0; | 26 | m_curSession = 0; |
27 | m_manager = new ProfileManager( m_factory ); | 27 | m_manager = new ProfileManager( m_factory ); |
28 | m_manager->load(); | 28 | m_manager->load(); |
29 | 29 | ||
30 | initUI(); | 30 | initUI(); |
31 | populateProfiles(); | 31 | populateProfiles(); |
32 | } | 32 | } |
33 | void MainWindow::initUI() { | 33 | void MainWindow::initUI() { |
34 | setToolBarsMovable( FALSE ); | 34 | setToolBarsMovable( FALSE ); |
35 | 35 | ||
36 | /* tool bar for the menu */ | 36 | /* tool bar for the menu */ |
37 | m_tool = new QToolBar( this ); | 37 | m_tool = new QToolBar( this ); |
38 | m_tool->setHorizontalStretchable( TRUE ); | 38 | m_tool->setHorizontalStretchable( TRUE ); |
39 | 39 | ||
40 | m_bar = new QMenuBar( m_tool ); | 40 | m_bar = new QMenuBar( m_tool ); |
41 | m_console = new QPopupMenu( this ); | 41 | m_console = new QPopupMenu( this ); |
42 | m_scripts = new QPopupMenu( this ); | 42 | m_scripts = new QPopupMenu( this ); |
43 | m_sessionsPop= new QPopupMenu( this ); | 43 | m_sessionsPop= new QPopupMenu( this ); |
44 | m_settings = new QPopupMenu( this ); | 44 | m_settings = new QPopupMenu( this ); |
45 | 45 | ||
46 | /* add a toolbar for icons */ | 46 | /* add a toolbar for icons */ |
47 | m_icons = new QToolBar(this); | 47 | m_icons = new QToolBar(this); |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * new Action for new sessions | 50 | * new Action for new sessions |
51 | */ | 51 | */ |
52 | QAction* a = new QAction(tr("New Connection"), | 52 | QAction* a = new QAction(tr("New Connection"), |
53 | Resource::loadPixmap( "new" ), | 53 | Resource::loadPixmap( "new" ), |
54 | QString::null, 0, this, 0); | 54 | QString::null, 0, this, 0); |
55 | a->addTo( m_console ); | 55 | a->addTo( m_console ); |
56 | a->addTo( m_icons ); | 56 | a->addTo( m_icons ); |
57 | connect(a, SIGNAL(activated() ), | 57 | connect(a, SIGNAL(activated() ), |
58 | this, SLOT(slotNew() ) ); | 58 | this, SLOT(slotNew() ) ); |
59 | 59 | ||
60 | /* | 60 | /* |
61 | * connect action | 61 | * connect action |
62 | */ | 62 | */ |
63 | m_connect = new QAction(); | 63 | m_connect = new QAction(); |
64 | m_connect->setText( tr("Connect") ); | 64 | m_connect->setText( tr("Connect") ); |
65 | m_connect->addTo( m_console ); | 65 | m_connect->addTo( m_console ); |
66 | connect(m_connect, SIGNAL(activated() ), | 66 | connect(m_connect, SIGNAL(activated() ), |
67 | this, SLOT(slotConnect() ) ); | 67 | this, SLOT(slotConnect() ) ); |
68 | 68 | ||
69 | /* | 69 | /* |
70 | * disconnect action | 70 | * disconnect action |
71 | */ | 71 | */ |
72 | m_disconnect = new QAction(); | 72 | m_disconnect = new QAction(); |
73 | m_disconnect->setText( tr("Disconnect") ); | 73 | m_disconnect->setText( tr("Disconnect") ); |
74 | m_disconnect->addTo( m_console ); | 74 | m_disconnect->addTo( m_console ); |
75 | connect(m_disconnect, SIGNAL(activated() ), | 75 | connect(m_disconnect, SIGNAL(activated() ), |
76 | this, SLOT(slotDisconnect() ) ); | 76 | this, SLOT(slotDisconnect() ) ); |
77 | 77 | ||
78 | m_transfer = new QAction(); | 78 | m_transfer = new QAction(); |
79 | m_transfer->setText( tr("Transfer file...") ); | 79 | m_transfer->setText( tr("Transfer file...") ); |
80 | m_transfer->addTo( m_console ); | 80 | m_transfer->addTo( m_console ); |
81 | connect(m_transfer, SIGNAL(activated() ), | 81 | connect(m_transfer, SIGNAL(activated() ), |
82 | this, SLOT(slotTransfer() ) ); | 82 | this, SLOT(slotTransfer() ) ); |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * terminate action | 85 | * terminate action |
86 | */ | 86 | */ |
87 | m_terminate = new QAction(); | 87 | m_terminate = new QAction(); |
88 | m_terminate->setText( tr("Terminate") ); | 88 | m_terminate->setText( tr("Terminate") ); |
89 | m_terminate->addTo( m_console ); | 89 | m_terminate->addTo( m_console ); |
90 | connect(m_terminate, SIGNAL(activated() ), | 90 | connect(m_terminate, SIGNAL(activated() ), |
91 | this, SLOT(slotTerminate() ) ); | 91 | this, SLOT(slotTerminate() ) ); |
92 | 92 | ||
93 | a = new QAction(); | 93 | a = new QAction(); |
94 | a->setText( tr("Close Window") ); | 94 | a->setText( tr("Close Window") ); |
95 | a->addTo( m_console ); | 95 | a->addTo( m_console ); |
96 | connect(a, SIGNAL(activated() ), | 96 | connect(a, SIGNAL(activated() ), |
97 | this, SLOT(slotClose() ) ); | 97 | this, SLOT(slotClose() ) ); |
98 | 98 | ||
99 | /* | 99 | /* |
100 | * the settings action | 100 | * the settings action |
101 | */ | 101 | */ |
102 | m_setProfiles = new QAction(tr("Configure Profiles"), | 102 | m_setProfiles = new QAction(tr("Configure Profiles"), |
103 | Resource::loadPixmap( "SettingsIcon" ), | 103 | Resource::loadPixmap( "SettingsIcon" ), |
104 | QString::null, 0, this, 0); | 104 | QString::null, 0, this, 0); |
105 | m_setProfiles->addTo( m_settings ); | 105 | m_setProfiles->addTo( m_settings ); |
106 | m_setProfiles->addTo( m_icons ); | 106 | m_setProfiles->addTo( m_icons ); |
107 | connect( m_setProfiles, SIGNAL(activated() ), | 107 | connect( m_setProfiles, SIGNAL(activated() ), |
108 | this, SLOT(slotConfigure() ) ); | 108 | this, SLOT(slotConfigure() ) ); |
109 | 109 | ||
110 | /* | 110 | /* |
111 | * script actions | 111 | * script actions |
112 | */ | 112 | */ |
113 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 113 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
114 | m_recordScript->addTo(m_scripts); | 114 | m_recordScript->addTo(m_scripts); |
115 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 115 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
116 | 116 | ||
117 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 117 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
118 | m_saveScript->addTo(m_scripts); | 118 | m_saveScript->addTo(m_scripts); |
119 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 119 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
120 | 120 | ||
121 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 121 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
122 | m_runScript->addTo(m_scripts); | 122 | m_runScript->addTo(m_scripts); |
123 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 123 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
124 | 124 | ||
125 | /* | 125 | /* |
126 | * action that open/closes the keyboard | 126 | * action that open/closes the keyboard |
127 | */ | 127 | */ |
128 | m_openKeys = new QAction (tr("Open Keyboard..."), | 128 | m_openKeys = new QAction (tr("Open Keyboard..."), |
129 | Resource::loadPixmap( "down" ), | 129 | Resource::loadPixmap( "down" ), |
130 | QString::null, 0, this, 0); | 130 | QString::null, 0, this, 0); |
131 | 131 | ||
132 | m_openKeys->setToggleAction(true); | 132 | m_openKeys->setToggleAction(true); |
133 | 133 | ||
134 | connect (m_openKeys, SIGNAL(toggled(bool)), | 134 | connect (m_openKeys, SIGNAL(toggled(bool)), |
135 | this, SLOT(slotOpenKeb(bool))); | 135 | this, SLOT(slotOpenKeb(bool))); |
136 | m_openKeys->addTo(m_icons); | 136 | m_openKeys->addTo(m_icons); |
137 | 137 | ||
138 | 138 | ||
139 | /* insert the submenu */ | 139 | /* insert the submenu */ |
140 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 140 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
141 | -1, 0); | 141 | -1, 0); |
142 | 142 | ||
143 | /* insert the connection menu */ | 143 | /* insert the connection menu */ |
144 | m_bar->insertItem( tr("Connection"), m_console ); | 144 | m_bar->insertItem( tr("Connection"), m_console ); |
145 | 145 | ||
146 | /* the scripts menu */ | 146 | /* the scripts menu */ |
147 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 147 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
148 | 148 | ||
149 | /* the settings menu */ | 149 | /* the settings menu */ |
150 | m_bar->insertItem( tr("Settings"), m_settings ); | 150 | m_bar->insertItem( tr("Settings"), m_settings ); |
151 | 151 | ||
152 | /* and the keyboard */ | 152 | /* and the keyboard */ |
153 | m_keyBar = new QToolBar(this); | 153 | m_keyBar = new QToolBar(this); |
154 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 154 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
155 | m_keyBar->setHorizontalStretchable( TRUE ); | 155 | m_keyBar->setHorizontalStretchable( TRUE ); |
156 | m_keyBar->hide(); | 156 | m_keyBar->hide(); |
157 | 157 | ||
158 | m_kb = new FunctionKeyboard(m_keyBar); | 158 | m_kb = new FunctionKeyboard(m_keyBar); |
159 | 159 | ||
160 | /* | 160 | /* |
161 | * connect to the menu activation | 161 | * connect to the menu activation |
162 | */ | 162 | */ |
163 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 163 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
164 | this, SLOT(slotProfile( int ) ) ); | 164 | this, SLOT(slotProfile( int ) ) ); |
165 | 165 | ||
166 | m_consoleWindow = new TabWidget( this, "blah"); | 166 | m_consoleWindow = new TabWidget( this, "blah"); |
167 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | ||
168 | this, SLOT(slotSessionChanged(Session*) ) ); | ||
167 | setCentralWidget( m_consoleWindow ); | 169 | setCentralWidget( m_consoleWindow ); |
168 | 170 | ||
169 | } | 171 | } |
170 | 172 | ||
171 | ProfileManager* MainWindow::manager() { | 173 | ProfileManager* MainWindow::manager() { |
172 | return m_manager; | 174 | return m_manager; |
173 | } | 175 | } |
174 | TabWidget* MainWindow::tabWidget() { | 176 | TabWidget* MainWindow::tabWidget() { |
175 | return m_consoleWindow; | 177 | return m_consoleWindow; |
176 | } | 178 | } |
177 | void MainWindow::populateProfiles() { | 179 | void MainWindow::populateProfiles() { |
178 | m_sessionsPop->clear(); | 180 | m_sessionsPop->clear(); |
179 | Profile::ValueList list = manager()->all(); | 181 | Profile::ValueList list = manager()->all(); |
180 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 182 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
181 | m_sessionsPop->insertItem( (*it).name() ); | 183 | m_sessionsPop->insertItem( (*it).name() ); |
182 | } | 184 | } |
183 | 185 | ||
184 | } | 186 | } |
185 | MainWindow::~MainWindow() { | 187 | MainWindow::~MainWindow() { |
186 | delete m_factory; | 188 | delete m_factory; |
187 | manager()->save(); | 189 | manager()->save(); |
188 | } | 190 | } |
189 | 191 | ||
190 | MetaFactory* MainWindow::factory() { | 192 | MetaFactory* MainWindow::factory() { |
191 | return m_factory; | 193 | return m_factory; |
192 | } | 194 | } |
193 | 195 | ||
194 | Session* MainWindow::currentSession() { | 196 | Session* MainWindow::currentSession() { |
195 | return m_curSession; | 197 | return m_curSession; |
196 | } | 198 | } |
197 | 199 | ||
198 | QList<Session> MainWindow::sessions() { | 200 | QList<Session> MainWindow::sessions() { |
199 | return m_sessions; | 201 | return m_sessions; |
200 | } | 202 | } |
201 | 203 | ||
202 | void MainWindow::slotNew() { | 204 | void MainWindow::slotNew() { |
203 | qWarning("New Connection"); | 205 | qWarning("New Connection"); |
204 | ProfileEditorDialog dlg(factory() ); | 206 | ProfileEditorDialog dlg(factory() ); |
205 | dlg.showMaximized(); | 207 | dlg.showMaximized(); |
206 | int ret = dlg.exec(); | 208 | int ret = dlg.exec(); |
207 | 209 | ||
208 | if ( ret == QDialog::Accepted ) { | 210 | if ( ret == QDialog::Accepted ) { |
209 | create( dlg.profile() ); | 211 | create( dlg.profile() ); |
210 | } | 212 | } |
211 | } | 213 | } |
212 | 214 | ||
213 | void MainWindow::slotRecordScript() { | 215 | void MainWindow::slotRecordScript() { |
214 | if (currentSession()) { | 216 | if (currentSession()) { |
215 | currentSession()->emulationLayer()->startRecording(); | 217 | currentSession()->emulationLayer()->startRecording(); |
216 | } | 218 | } |
217 | } | 219 | } |
218 | 220 | ||
219 | void MainWindow::slotSaveScript() { | 221 | void MainWindow::slotSaveScript() { |
220 | if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | 222 | if (currentSession() && currentSession()->emulationLayer()->isRecording()) { |
221 | MimeTypes types; | 223 | MimeTypes types; |
222 | QStringList script; | 224 | QStringList script; |
223 | script << "text/plain"; | 225 | script << "text/plain"; |
224 | types.insert("Script", script); | 226 | types.insert("Script", script); |
225 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 227 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
226 | if (!filename.isEmpty()) { | 228 | if (!filename.isEmpty()) { |
227 | currentSession()->emulationLayer()->script()->saveTo(filename); | 229 | currentSession()->emulationLayer()->script()->saveTo(filename); |
228 | currentSession()->emulationLayer()->clearScript(); | 230 | currentSession()->emulationLayer()->clearScript(); |
229 | } | 231 | } |
230 | } | 232 | } |
231 | } | 233 | } |
232 | 234 | ||
233 | void MainWindow::slotRunScript() { | 235 | void MainWindow::slotRunScript() { |
234 | if (currentSession()) { | 236 | if (currentSession()) { |
235 | MimeTypes types; | 237 | MimeTypes types; |
236 | QStringList script; | 238 | QStringList script; |
237 | script << "text/plain"; | 239 | script << "text/plain"; |
238 | types.insert("Script", script); | 240 | types.insert("Script", script); |
239 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 241 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
240 | if (!filename.isEmpty()) { | 242 | if (!filename.isEmpty()) { |
241 | Script script(DocLnk(filename).file()); | 243 | Script script(DocLnk(filename).file()); |
242 | currentSession()->emulationLayer()->runScript(&script); | 244 | currentSession()->emulationLayer()->runScript(&script); |
243 | } | 245 | } |
244 | } | 246 | } |
245 | } | 247 | } |
246 | 248 | ||
247 | void MainWindow::slotConnect() { | 249 | void MainWindow::slotConnect() { |
248 | if ( currentSession() ) | 250 | if ( currentSession() ) |
249 | currentSession()->layer()->open(); | 251 | currentSession()->layer()->open(); |
250 | } | 252 | } |
251 | 253 | ||
252 | void MainWindow::slotDisconnect() { | 254 | void MainWindow::slotDisconnect() { |
253 | if ( currentSession() ) | 255 | if ( currentSession() ) |
254 | currentSession()->layer()->close(); | 256 | currentSession()->layer()->close(); |
255 | } | 257 | } |
256 | 258 | ||
257 | void MainWindow::slotTerminate() { | 259 | void MainWindow::slotTerminate() { |
258 | if ( currentSession() ) | 260 | if ( currentSession() ) |
259 | currentSession()->layer()->close(); | 261 | currentSession()->layer()->close(); |
260 | 262 | ||
261 | slotClose(); | 263 | slotClose(); |
262 | /* FIXME move to the next session */ | 264 | /* FIXME move to the next session */ |
263 | } | 265 | } |
264 | 266 | ||
265 | void MainWindow::slotConfigure() { | 267 | void MainWindow::slotConfigure() { |
266 | qWarning("configure"); | 268 | qWarning("configure"); |
267 | ConfigDialog conf( manager()->all(), factory() ); | 269 | ConfigDialog conf( manager()->all(), factory() ); |
268 | conf.showMaximized(); | 270 | conf.showMaximized(); |
269 | 271 | ||
270 | int ret = conf.exec(); | 272 | int ret = conf.exec(); |
271 | 273 | ||
272 | if ( QDialog::Accepted == ret ) { | 274 | if ( QDialog::Accepted == ret ) { |
273 | qWarning("conf %d", conf.list().count() ); | 275 | qWarning("conf %d", conf.list().count() ); |
274 | manager()->setProfiles( conf.list() ); | 276 | manager()->setProfiles( conf.list() ); |
275 | populateProfiles(); | 277 | populateProfiles(); |
276 | } | 278 | } |
277 | } | 279 | } |
278 | /* | 280 | /* |
279 | * we will remove | 281 | * we will remove |
280 | * this window from the tabwidget | 282 | * this window from the tabwidget |
281 | * remove it from the list | 283 | * remove it from the list |
282 | * delete it | 284 | * delete it |
283 | * and set the currentSession() | 285 | * and set the currentSession() |
284 | */ | 286 | */ |
285 | void MainWindow::slotClose() { | 287 | void MainWindow::slotClose() { |
286 | qWarning("close"); | 288 | qWarning("close"); |
287 | if (!currentSession() ) | 289 | if (!currentSession() ) |
288 | return; | 290 | return; |
289 | 291 | ||
290 | tabWidget()->remove( currentSession() ); | 292 | tabWidget()->remove( currentSession() ); |
291 | /*it's autodelete */ | 293 | /*it's autodelete */ |
292 | m_sessions.remove( m_curSession ); | 294 | m_sessions.remove( m_curSession ); |
293 | m_curSession = m_sessions.first(); | 295 | m_curSession = m_sessions.first(); |
294 | tabWidget()->setCurrent( m_curSession ); | 296 | tabWidget()->setCurrent( m_curSession ); |
295 | } | 297 | } |
296 | 298 | ||
297 | /* | 299 | /* |
298 | * We will get the name | 300 | * We will get the name |
299 | * Then the profile | 301 | * Then the profile |
300 | * and then we will make a profile | 302 | * and then we will make a profile |
301 | */ | 303 | */ |
302 | void MainWindow::slotProfile( int id) { | 304 | void MainWindow::slotProfile( int id) { |
303 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 305 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
304 | create( prof ); | 306 | create( prof ); |
305 | } | 307 | } |
306 | void MainWindow::create( const Profile& prof ) { | 308 | void MainWindow::create( const Profile& prof ) { |
307 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 309 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
308 | 310 | ||
309 | m_sessions.append( ses ); | 311 | m_sessions.append( ses ); |
310 | tabWidget()->add( ses ); | 312 | tabWidget()->add( ses ); |
311 | m_curSession = ses; | 313 | m_curSession = ses; |
312 | 314 | ||
313 | } | 315 | } |
314 | 316 | ||
315 | void MainWindow::slotTransfer() | 317 | void MainWindow::slotTransfer() |
316 | { | 318 | { |
317 | if ( currentSession() ) { | 319 | if ( currentSession() ) { |
318 | TransferDialog dlg(this); | 320 | TransferDialog dlg(this); |
319 | //dlg.showMaximized(); | 321 | //dlg.showMaximized(); |
320 | dlg.exec(); | 322 | dlg.exec(); |
321 | } | 323 | } |
322 | } | 324 | } |
323 | 325 | ||
324 | 326 | ||
325 | void MainWindow::slotOpenKeb(bool state) { | 327 | void MainWindow::slotOpenKeb(bool state) { |
326 | 328 | ||
327 | if (state) m_keyBar->show(); | 329 | if (state) m_keyBar->show(); |
328 | else m_keyBar->hide(); | 330 | else m_keyBar->hide(); |
329 | 331 | ||
330 | } | 332 | } |
333 | void MainWindow::slotSessionChanged( Session* ses ) { | ||
334 | if ( ses ) { | ||
335 | qWarning("changing %s", ses->name().latin1() ); | ||
336 | m_curSession = ses; | ||
337 | } | ||
338 | } | ||
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 94144a4..d16d6af 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -1,108 +1,109 @@ | |||
1 | #ifndef OPIE_MAIN_WINDOW_H | 1 | #ifndef OPIE_MAIN_WINDOW_H |
2 | #define OPIE_MAIN_WINDOW_H | 2 | #define OPIE_MAIN_WINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | 6 | ||
7 | #include "session.h" | 7 | #include "session.h" |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * this is the MainWindow of the new opie console | 10 | * this is the MainWindow of the new opie console |
11 | * it's also the dispatcher between the different | 11 | * it's also the dispatcher between the different |
12 | * actions supported by the gui | 12 | * actions supported by the gui |
13 | */ | 13 | */ |
14 | class QToolBar; | 14 | class QToolBar; |
15 | class QToolButton; | 15 | class QToolButton; |
16 | class QMenuBar; | 16 | class QMenuBar; |
17 | class QAction; | 17 | class QAction; |
18 | class MetaFactory; | 18 | class MetaFactory; |
19 | class TabWidget; | 19 | class TabWidget; |
20 | class ProfileManager; | 20 | class ProfileManager; |
21 | class Profile; | 21 | class Profile; |
22 | class FunctionKeyboard; | 22 | class FunctionKeyboard; |
23 | class MainWindow : public QMainWindow { | 23 | class MainWindow : public QMainWindow { |
24 | Q_OBJECT | 24 | Q_OBJECT |
25 | public: | 25 | public: |
26 | MainWindow(); | 26 | MainWindow(); |
27 | ~MainWindow(); | 27 | ~MainWindow(); |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * our factory to generate IOLayer and so on | 30 | * our factory to generate IOLayer and so on |
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | MetaFactory* factory(); | 33 | MetaFactory* factory(); |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * A session contains a QWidget*, | 36 | * A session contains a QWidget*, |
37 | * an IOLayer* and some infos for us | 37 | * an IOLayer* and some infos for us |
38 | */ | 38 | */ |
39 | Session* currentSession(); | 39 | Session* currentSession(); |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * the session list | 42 | * the session list |
43 | */ | 43 | */ |
44 | QList<Session> sessions(); | 44 | QList<Session> sessions(); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * | 47 | * |
48 | */ | 48 | */ |
49 | ProfileManager* manager(); | 49 | ProfileManager* manager(); |
50 | TabWidget* tabWidget(); | 50 | TabWidget* tabWidget(); |
51 | 51 | ||
52 | private slots: | 52 | private slots: |
53 | void slotNew(); | 53 | void slotNew(); |
54 | void slotConnect(); | 54 | void slotConnect(); |
55 | void slotDisconnect(); | 55 | void slotDisconnect(); |
56 | void slotTerminate(); | 56 | void slotTerminate(); |
57 | void slotConfigure(); | 57 | void slotConfigure(); |
58 | void slotClose(); | 58 | void slotClose(); |
59 | void slotProfile(int); | 59 | void slotProfile(int); |
60 | void slotTransfer(); | 60 | void slotTransfer(); |
61 | void slotOpenKeb(bool); | 61 | void slotOpenKeb(bool); |
62 | void slotRecordScript(); | 62 | void slotRecordScript(); |
63 | void slotSaveScript(); | 63 | void slotSaveScript(); |
64 | void slotRunScript(); | 64 | void slotRunScript(); |
65 | void slotSessionChanged( Session* ); | ||
65 | private: | 66 | private: |
66 | void initUI(); | 67 | void initUI(); |
67 | void populateProfiles(); | 68 | void populateProfiles(); |
68 | void create( const Profile& ); | 69 | void create( const Profile& ); |
69 | /** | 70 | /** |
70 | * the current session | 71 | * the current session |
71 | */ | 72 | */ |
72 | Session* m_curSession; | 73 | Session* m_curSession; |
73 | 74 | ||
74 | /** | 75 | /** |
75 | * the session list | 76 | * the session list |
76 | */ | 77 | */ |
77 | QList<Session> m_sessions; | 78 | QList<Session> m_sessions; |
78 | 79 | ||
79 | /** | 80 | /** |
80 | * the metafactory | 81 | * the metafactory |
81 | */ | 82 | */ |
82 | MetaFactory* m_factory; | 83 | MetaFactory* m_factory; |
83 | ProfileManager* m_manager; | 84 | ProfileManager* m_manager; |
84 | 85 | ||
85 | TabWidget* m_consoleWindow; | 86 | TabWidget* m_consoleWindow; |
86 | QToolBar* m_tool; | 87 | QToolBar* m_tool; |
87 | QToolBar* m_icons; | 88 | QToolBar* m_icons; |
88 | QToolBar* m_keyBar; | 89 | QToolBar* m_keyBar; |
89 | QMenuBar* m_bar; | 90 | QMenuBar* m_bar; |
90 | QPopupMenu* m_console; | 91 | QPopupMenu* m_console; |
91 | QPopupMenu* m_settings; | 92 | QPopupMenu* m_settings; |
92 | QPopupMenu* m_sessionsPop; | 93 | QPopupMenu* m_sessionsPop; |
93 | QPopupMenu* m_scripts; | 94 | QPopupMenu* m_scripts; |
94 | QAction* m_connect; | 95 | QAction* m_connect; |
95 | QAction* m_disconnect; | 96 | QAction* m_disconnect; |
96 | QAction* m_terminate; | 97 | QAction* m_terminate; |
97 | QAction* m_transfer; | 98 | QAction* m_transfer; |
98 | QAction* m_setProfiles; | 99 | QAction* m_setProfiles; |
99 | QAction* m_openKeys; | 100 | QAction* m_openKeys; |
100 | QAction* m_recordScript; | 101 | QAction* m_recordScript; |
101 | QAction* m_saveScript; | 102 | QAction* m_saveScript; |
102 | QAction* m_runScript; | 103 | QAction* m_runScript; |
103 | 104 | ||
104 | FunctionKeyboard *m_kb; | 105 | FunctionKeyboard *m_kb; |
105 | }; | 106 | }; |
106 | 107 | ||
107 | 108 | ||
108 | #endif | 109 | #endif |