author | hash <hash> | 2002-10-24 08:17:22 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-24 08:17:22 (UTC) |
commit | 4e8f0ba4a0c43d3dc4f3c4f89f2d796c3f8e5990 (patch) (unidiff) | |
tree | f7c83378e657bcbae6ae505d25214bdac405641a | |
parent | 541035d4308ca1931d5068ced83b0cb5350b0766 (diff) | |
download | opie-4e8f0ba4a0c43d3dc4f3c4f89f2d796c3f8e5990.zip opie-4e8f0ba4a0c43d3dc4f3c4f89f2d796c3f8e5990.tar.gz opie-4e8f0ba4a0c43d3dc4f3c4f89f2d796c3f8e5990.tar.bz2 |
commented out the other button bar.
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 8e529a3..e2f4d12 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,381 +1,382 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qmenubar.h> | 4 | #include <qmenubar.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | #include <qtoolbar.h> | 7 | #include <qtoolbar.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qwhatsthis.h> | 10 | #include <qwhatsthis.h> |
11 | 11 | ||
12 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
13 | 13 | ||
14 | #include <opie/ofiledialog.h> | 14 | #include <opie/ofiledialog.h> |
15 | 15 | ||
16 | #include "keytrans.h" | 16 | #include "keytrans.h" |
17 | #include "profileeditordialog.h" | 17 | #include "profileeditordialog.h" |
18 | #include "configdialog.h" | 18 | #include "configdialog.h" |
19 | #include "default.h" | 19 | #include "default.h" |
20 | #include "metafactory.h" | 20 | #include "metafactory.h" |
21 | #include "profile.h" | 21 | #include "profile.h" |
22 | #include "profilemanager.h" | 22 | #include "profilemanager.h" |
23 | #include "mainwindow.h" | 23 | #include "mainwindow.h" |
24 | #include "tabwidget.h" | 24 | #include "tabwidget.h" |
25 | #include "transferdialog.h" | 25 | #include "transferdialog.h" |
26 | #include "function_keyboard.h" | 26 | #include "function_keyboard.h" |
27 | #include "emulation_handler.h" | 27 | #include "emulation_handler.h" |
28 | #include "script.h" | 28 | #include "script.h" |
29 | #include "quick_button.h" | 29 | #include "quick_button.h" |
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
33 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 33 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
34 | KeyTrans::loadAll(); | 34 | KeyTrans::loadAll(); |
35 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 35 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
36 | KeyTrans* s = KeyTrans::find(i ); | 36 | KeyTrans* s = KeyTrans::find(i ); |
37 | assert( s ); | 37 | assert( s ); |
38 | } | 38 | } |
39 | m_factory = new MetaFactory(); | 39 | m_factory = new MetaFactory(); |
40 | Default def(m_factory); | 40 | Default def(m_factory); |
41 | m_sessions.setAutoDelete( TRUE ); | 41 | m_sessions.setAutoDelete( TRUE ); |
42 | m_curSession = 0; | 42 | m_curSession = 0; |
43 | m_manager = new ProfileManager( m_factory ); | 43 | m_manager = new ProfileManager( m_factory ); |
44 | m_manager->load(); | 44 | m_manager->load(); |
45 | 45 | ||
46 | initUI(); | 46 | initUI(); |
47 | populateProfiles(); | 47 | populateProfiles(); |
48 | } | 48 | } |
49 | void MainWindow::initUI() { | 49 | void MainWindow::initUI() { |
50 | setToolBarsMovable( FALSE ); | 50 | setToolBarsMovable( FALSE ); |
51 | 51 | ||
52 | /* tool bar for the menu */ | 52 | /* tool bar for the menu */ |
53 | m_tool = new QToolBar( this ); | 53 | m_tool = new QToolBar( this ); |
54 | m_tool->setHorizontalStretchable( TRUE ); | 54 | m_tool->setHorizontalStretchable( TRUE ); |
55 | 55 | ||
56 | m_bar = new QMenuBar( m_tool ); | 56 | m_bar = new QMenuBar( m_tool ); |
57 | m_console = new QPopupMenu( this ); | 57 | m_console = new QPopupMenu( this ); |
58 | m_scripts = new QPopupMenu( this ); | 58 | m_scripts = new QPopupMenu( this ); |
59 | m_sessionsPop= new QPopupMenu( this ); | 59 | m_sessionsPop= new QPopupMenu( this ); |
60 | //m_settings = new QPopupMenu( this ); | 60 | //m_settings = new QPopupMenu( this ); |
61 | 61 | ||
62 | /* add a toolbar for icons */ | 62 | /* add a toolbar for icons */ |
63 | m_icons = new QToolBar(this); | 63 | m_icons = new QToolBar(this); |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | /* | 68 | /* |
69 | * the settings action | 69 | * the settings action |
70 | */ | 70 | */ |
71 | m_setProfiles = new QAction(tr("Configure Profiles"), | 71 | m_setProfiles = new QAction(tr("Configure Profiles"), |
72 | Resource::loadPixmap( "SettingsIcon" ), | 72 | Resource::loadPixmap( "SettingsIcon" ), |
73 | QString::null, 0, this, 0); | 73 | QString::null, 0, this, 0); |
74 | // m_setProfiles->addTo( m_settings ); | 74 | // m_setProfiles->addTo( m_settings ); |
75 | m_setProfiles->addTo( m_icons ); | 75 | m_setProfiles->addTo( m_icons ); |
76 | m_setProfiles->addTo( m_console ); | 76 | m_setProfiles->addTo( m_console ); |
77 | connect( m_setProfiles, SIGNAL(activated() ), | 77 | connect( m_setProfiles, SIGNAL(activated() ), |
78 | this, SLOT(slotConfigure() ) ); | 78 | this, SLOT(slotConfigure() ) ); |
79 | 79 | ||
80 | m_console->insertSeparator(); | 80 | m_console->insertSeparator(); |
81 | /* | 81 | /* |
82 | * new Action for new sessions | 82 | * new Action for new sessions |
83 | */ | 83 | */ |
84 | QAction* a = new QAction(tr("New Connection"), | 84 | QAction* a = new QAction(tr("New Connection"), |
85 | Resource::loadPixmap( "new" ), | 85 | Resource::loadPixmap( "new" ), |
86 | QString::null, 0, this, 0); | 86 | QString::null, 0, this, 0); |
87 | a->addTo( m_console ); | 87 | a->addTo( m_console ); |
88 | a->addTo( m_icons ); | 88 | a->addTo( m_icons ); |
89 | connect(a, SIGNAL(activated() ), | 89 | connect(a, SIGNAL(activated() ), |
90 | this, SLOT(slotNew() ) ); | 90 | this, SLOT(slotNew() ) ); |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * connect action | 93 | * connect action |
94 | */ | 94 | */ |
95 | m_connect = new QAction(); | 95 | m_connect = new QAction(); |
96 | m_connect->setText( tr("Connect") ); | 96 | m_connect->setText( tr("Connect") ); |
97 | m_connect->addTo( m_console ); | 97 | m_connect->addTo( m_console ); |
98 | connect(m_connect, SIGNAL(activated() ), | 98 | connect(m_connect, SIGNAL(activated() ), |
99 | this, SLOT(slotConnect() ) ); | 99 | this, SLOT(slotConnect() ) ); |
100 | 100 | ||
101 | /* | 101 | /* |
102 | * disconnect action | 102 | * disconnect action |
103 | */ | 103 | */ |
104 | m_disconnect = new QAction(); | 104 | m_disconnect = new QAction(); |
105 | m_disconnect->setText( tr("Disconnect") ); | 105 | m_disconnect->setText( tr("Disconnect") ); |
106 | m_disconnect->addTo( m_console ); | 106 | m_disconnect->addTo( m_console ); |
107 | connect(m_disconnect, SIGNAL(activated() ), | 107 | connect(m_disconnect, SIGNAL(activated() ), |
108 | this, SLOT(slotDisconnect() ) ); | 108 | this, SLOT(slotDisconnect() ) ); |
109 | 109 | ||
110 | m_console->insertSeparator(); | 110 | m_console->insertSeparator(); |
111 | 111 | ||
112 | m_transfer = new QAction(); | 112 | m_transfer = new QAction(); |
113 | m_transfer->setText( tr("Transfer file...") ); | 113 | m_transfer->setText( tr("Transfer file...") ); |
114 | m_transfer->addTo( m_console ); | 114 | m_transfer->addTo( m_console ); |
115 | connect(m_transfer, SIGNAL(activated() ), | 115 | connect(m_transfer, SIGNAL(activated() ), |
116 | this, SLOT(slotTransfer() ) ); | 116 | this, SLOT(slotTransfer() ) ); |
117 | 117 | ||
118 | 118 | ||
119 | /* | 119 | /* |
120 | * fullscreen | 120 | * fullscreen |
121 | */ | 121 | */ |
122 | m_isFullscreen = false; | 122 | m_isFullscreen = false; |
123 | 123 | ||
124 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 124 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
125 | , QString::null, 0, this, 0); | 125 | , QString::null, 0, this, 0); |
126 | m_fullscreen->addTo( m_console ); | 126 | m_fullscreen->addTo( m_console ); |
127 | m_fullscreen->addTo( m_icons ); | 127 | m_fullscreen->addTo( m_icons ); |
128 | connect( m_fullscreen, SIGNAL( activated() ), | 128 | connect( m_fullscreen, SIGNAL( activated() ), |
129 | this, SLOT( slotFullscreen() ) ); | 129 | this, SLOT( slotFullscreen() ) ); |
130 | 130 | ||
131 | m_console->insertSeparator(); | 131 | m_console->insertSeparator(); |
132 | /* | 132 | /* |
133 | * terminate action | 133 | * terminate action |
134 | */ | 134 | */ |
135 | m_terminate = new QAction(); | 135 | m_terminate = new QAction(); |
136 | m_terminate->setText( tr("Terminate") ); | 136 | m_terminate->setText( tr("Terminate") ); |
137 | m_terminate->addTo( m_console ); | 137 | m_terminate->addTo( m_console ); |
138 | connect(m_terminate, SIGNAL(activated() ), | 138 | connect(m_terminate, SIGNAL(activated() ), |
139 | this, SLOT(slotTerminate() ) ); | 139 | this, SLOT(slotTerminate() ) ); |
140 | 140 | ||
141 | m_closewindow = new QAction(); | 141 | m_closewindow = new QAction(); |
142 | m_closewindow->setText( tr("Close Window") ); | 142 | m_closewindow->setText( tr("Close Window") ); |
143 | m_closewindow->addTo( m_console ); | 143 | m_closewindow->addTo( m_console ); |
144 | connect( m_closewindow, SIGNAL(activated() ), | 144 | connect( m_closewindow, SIGNAL(activated() ), |
145 | this, SLOT(slotClose() ) ); | 145 | this, SLOT(slotClose() ) ); |
146 | 146 | ||
147 | 147 | ||
148 | /* | 148 | /* |
149 | * script actions | 149 | * script actions |
150 | */ | 150 | */ |
151 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 151 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
152 | m_recordScript->addTo(m_scripts); | 152 | m_recordScript->addTo(m_scripts); |
153 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 153 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
154 | 154 | ||
155 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 155 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
156 | m_saveScript->addTo(m_scripts); | 156 | m_saveScript->addTo(m_scripts); |
157 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 157 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
158 | 158 | ||
159 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 159 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
160 | m_runScript->addTo(m_scripts); | 160 | m_runScript->addTo(m_scripts); |
161 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 161 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
162 | 162 | ||
163 | /* | 163 | /* |
164 | * action that open/closes the keyboard | 164 | * action that open/closes the keyboard |
165 | */ | 165 | */ |
166 | m_openKeys = new QAction (tr("Open Keyboard..."), | 166 | m_openKeys = new QAction (tr("Open Keyboard..."), |
167 | Resource::loadPixmap( "console/keyboard_icon.png" ), | 167 | Resource::loadPixmap( "down" ), |
168 | QString::null, 0, this, 0); | 168 | QString::null, 0, this, 0); |
169 | 169 | ||
170 | m_openKeys->setToggleAction(true); | 170 | m_openKeys->setToggleAction(true); |
171 | 171 | ||
172 | connect (m_openKeys, SIGNAL(toggled(bool)), | 172 | connect (m_openKeys, SIGNAL(toggled(bool)), |
173 | this, SLOT(slotOpenKeb(bool))); | 173 | this, SLOT(slotOpenKeb(bool))); |
174 | m_openKeys->addTo(m_icons); | 174 | m_openKeys->addTo(m_icons); |
175 | 175 | ||
176 | 176 | ||
177 | /* | 177 | /* |
178 | * action that open/closes the keyboard | 178 | * action that open/closes the keyboard |
179 | */ | 179 | |
180 | m_openButtons = new QAction ( tr( "Open Buttons..." ), | 180 | m_openButtons = new QAction ( tr( "Open Buttons..." ), |
181 | Resource::loadPixmap( "down" ), | 181 | Resource::loadPixmap( "" ), |
182 | QString::null, 0, this, 0 ); | 182 | QString::null, 0, this, 0 ); |
183 | 183 | ||
184 | m_openButtons->setToggleAction( true ); | 184 | m_openButtons->setToggleAction( true ); |
185 | 185 | ||
186 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), | 186 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), |
187 | this, SLOT( slotOpenButtons( bool ) ) ); | 187 | this, SLOT( slotOpenButtons( bool ) ) ); |
188 | m_openButtons->addTo( m_icons ); | 188 | m_openButtons->addTo( m_icons ); |
189 | 189 | ||
190 | */ | ||
190 | 191 | ||
191 | /* insert the submenu */ | 192 | /* insert the submenu */ |
192 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 193 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
193 | -1, 0); | 194 | -1, 0); |
194 | 195 | ||
195 | /* insert the connection menu */ | 196 | /* insert the connection menu */ |
196 | m_bar->insertItem( tr("Connection"), m_console ); | 197 | m_bar->insertItem( tr("Connection"), m_console ); |
197 | 198 | ||
198 | /* the scripts menu */ | 199 | /* the scripts menu */ |
199 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 200 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
200 | 201 | ||
201 | /* the settings menu */ | 202 | /* the settings menu */ |
202 | // m_bar->insertItem( tr("Settings"), m_settings ); | 203 | // m_bar->insertItem( tr("Settings"), m_settings ); |
203 | 204 | ||
204 | /* and the keyboard */ | 205 | /* and the keyboard */ |
205 | m_keyBar = new QToolBar(this); | 206 | m_keyBar = new QToolBar(this); |
206 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 207 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
207 | m_keyBar->setHorizontalStretchable( TRUE ); | 208 | m_keyBar->setHorizontalStretchable( TRUE ); |
208 | m_keyBar->hide(); | 209 | m_keyBar->hide(); |
209 | 210 | ||
210 | m_kb = new FunctionKeyboard(m_keyBar); | 211 | m_kb = new FunctionKeyboard(m_keyBar); |
211 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 212 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
212 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 213 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
213 | 214 | ||
214 | m_buttonBar = new QToolBar( this ); | 215 | m_buttonBar = new QToolBar( this ); |
215 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | 216 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); |
216 | m_buttonBar->setHorizontalStretchable( TRUE ); | 217 | m_buttonBar->setHorizontalStretchable( TRUE ); |
217 | m_buttonBar->hide(); | 218 | m_buttonBar->hide(); |
218 | 219 | ||
219 | /* | 220 | /* |
220 | m_qb = new QuickButton( m_buttonBar ); | 221 | m_qb = new QuickButton( m_buttonBar ); |
221 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), | 222 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), |
222 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); | 223 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); |
223 | */ | 224 | */ |
224 | 225 | ||
225 | 226 | ||
226 | m_connect->setEnabled( false ); | 227 | m_connect->setEnabled( false ); |
227 | m_disconnect->setEnabled( false ); | 228 | m_disconnect->setEnabled( false ); |
228 | m_terminate->setEnabled( false ); | 229 | m_terminate->setEnabled( false ); |
229 | m_transfer->setEnabled( false ); | 230 | m_transfer->setEnabled( false ); |
230 | m_recordScript->setEnabled( false ); | 231 | m_recordScript->setEnabled( false ); |
231 | m_saveScript->setEnabled( false ); | 232 | m_saveScript->setEnabled( false ); |
232 | m_runScript->setEnabled( false ); | 233 | m_runScript->setEnabled( false ); |
233 | m_fullscreen->setEnabled( false ); | 234 | m_fullscreen->setEnabled( false ); |
234 | m_closewindow->setEnabled( false ); | 235 | m_closewindow->setEnabled( false ); |
235 | 236 | ||
236 | /* | 237 | /* |
237 | * connect to the menu activation | 238 | * connect to the menu activation |
238 | */ | 239 | */ |
239 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 240 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
240 | this, SLOT(slotProfile( int ) ) ); | 241 | this, SLOT(slotProfile( int ) ) ); |
241 | 242 | ||
242 | m_consoleWindow = new TabWidget( this, "blah"); | 243 | m_consoleWindow = new TabWidget( this, "blah"); |
243 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 244 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
244 | this, SLOT(slotSessionChanged(Session*) ) ); | 245 | this, SLOT(slotSessionChanged(Session*) ) ); |
245 | setCentralWidget( m_consoleWindow ); | 246 | setCentralWidget( m_consoleWindow ); |
246 | 247 | ||
247 | } | 248 | } |
248 | 249 | ||
249 | ProfileManager* MainWindow::manager() { | 250 | ProfileManager* MainWindow::manager() { |
250 | return m_manager; | 251 | return m_manager; |
251 | } | 252 | } |
252 | TabWidget* MainWindow::tabWidget() { | 253 | TabWidget* MainWindow::tabWidget() { |
253 | return m_consoleWindow; | 254 | return m_consoleWindow; |
254 | } | 255 | } |
255 | void MainWindow::populateProfiles() { | 256 | void MainWindow::populateProfiles() { |
256 | m_sessionsPop->clear(); | 257 | m_sessionsPop->clear(); |
257 | Profile::ValueList list = manager()->all(); | 258 | Profile::ValueList list = manager()->all(); |
258 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 259 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
259 | m_sessionsPop->insertItem( (*it).name() ); | 260 | m_sessionsPop->insertItem( (*it).name() ); |
260 | } | 261 | } |
261 | 262 | ||
262 | } | 263 | } |
263 | MainWindow::~MainWindow() { | 264 | MainWindow::~MainWindow() { |
264 | delete m_factory; | 265 | delete m_factory; |
265 | manager()->save(); | 266 | manager()->save(); |
266 | } | 267 | } |
267 | 268 | ||
268 | MetaFactory* MainWindow::factory() { | 269 | MetaFactory* MainWindow::factory() { |
269 | return m_factory; | 270 | return m_factory; |
270 | } | 271 | } |
271 | 272 | ||
272 | Session* MainWindow::currentSession() { | 273 | Session* MainWindow::currentSession() { |
273 | return m_curSession; | 274 | return m_curSession; |
274 | } | 275 | } |
275 | 276 | ||
276 | QList<Session> MainWindow::sessions() { | 277 | QList<Session> MainWindow::sessions() { |
277 | return m_sessions; | 278 | return m_sessions; |
278 | } | 279 | } |
279 | 280 | ||
280 | void MainWindow::slotNew() { | 281 | void MainWindow::slotNew() { |
281 | ProfileEditorDialog dlg(factory() ); | 282 | ProfileEditorDialog dlg(factory() ); |
282 | dlg.showMaximized(); | 283 | dlg.showMaximized(); |
283 | int ret = dlg.exec(); | 284 | int ret = dlg.exec(); |
284 | 285 | ||
285 | if ( ret == QDialog::Accepted ) { | 286 | if ( ret == QDialog::Accepted ) { |
286 | create( dlg.profile() ); | 287 | create( dlg.profile() ); |
287 | } | 288 | } |
288 | } | 289 | } |
289 | 290 | ||
290 | void MainWindow::slotRecordScript() { | 291 | void MainWindow::slotRecordScript() { |
291 | if (currentSession()) { | 292 | if (currentSession()) { |
292 | currentSession()->emulationHandler()->startRecording(); | 293 | currentSession()->emulationHandler()->startRecording(); |
293 | } | 294 | } |
294 | } | 295 | } |
295 | 296 | ||
296 | void MainWindow::slotSaveScript() { | 297 | void MainWindow::slotSaveScript() { |
297 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 298 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
298 | MimeTypes types; | 299 | MimeTypes types; |
299 | QStringList script; | 300 | QStringList script; |
300 | script << "text/plain"; | 301 | script << "text/plain"; |
301 | script << "text/all"; | 302 | script << "text/all"; |
302 | script << "application/octet-stream"; | 303 | script << "application/octet-stream"; |
303 | types.insert("Script", script); | 304 | types.insert("Script", script); |
304 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 305 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
305 | if (!filename.isEmpty()) { | 306 | if (!filename.isEmpty()) { |
306 | currentSession()->emulationHandler()->script()->saveTo(filename); | 307 | currentSession()->emulationHandler()->script()->saveTo(filename); |
307 | currentSession()->emulationHandler()->clearScript(); | 308 | currentSession()->emulationHandler()->clearScript(); |
308 | } | 309 | } |
309 | } | 310 | } |
310 | } | 311 | } |
311 | 312 | ||
312 | void MainWindow::slotRunScript() { | 313 | void MainWindow::slotRunScript() { |
313 | if (currentSession()) { | 314 | if (currentSession()) { |
314 | MimeTypes types; | 315 | MimeTypes types; |
315 | QStringList script; | 316 | QStringList script; |
316 | script << "text/plain"; | 317 | script << "text/plain"; |
317 | script << "text/all"; | 318 | script << "text/all"; |
318 | script << "application/octet-stream"; | 319 | script << "application/octet-stream"; |
319 | types.insert("Script", script); | 320 | types.insert("Script", script); |
320 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 321 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
321 | if (!filename.isEmpty()) { | 322 | if (!filename.isEmpty()) { |
322 | Script script(DocLnk(filename).file()); | 323 | Script script(DocLnk(filename).file()); |
323 | currentSession()->emulationHandler()->runScript(&script); | 324 | currentSession()->emulationHandler()->runScript(&script); |
324 | } | 325 | } |
325 | } | 326 | } |
326 | } | 327 | } |
327 | 328 | ||
328 | void MainWindow::slotConnect() { | 329 | void MainWindow::slotConnect() { |
329 | if ( currentSession() ) { | 330 | if ( currentSession() ) { |
330 | bool ret = currentSession()->layer()->open(); | 331 | bool ret = currentSession()->layer()->open(); |
331 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 332 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
332 | QObject::tr("Failed"), | 333 | QObject::tr("Failed"), |
333 | QObject::tr("Connecting failed for this session.")); | 334 | QObject::tr("Connecting failed for this session.")); |
334 | else { | 335 | else { |
335 | m_connect->setEnabled( false ); | 336 | m_connect->setEnabled( false ); |
336 | m_disconnect->setEnabled( true ); | 337 | m_disconnect->setEnabled( true ); |
337 | } | 338 | } |
338 | } | 339 | } |
339 | } | 340 | } |
340 | 341 | ||
341 | void MainWindow::slotDisconnect() { | 342 | void MainWindow::slotDisconnect() { |
342 | if ( currentSession() ) { | 343 | if ( currentSession() ) { |
343 | currentSession()->layer()->close(); | 344 | currentSession()->layer()->close(); |
344 | m_connect->setEnabled( true ); | 345 | m_connect->setEnabled( true ); |
345 | m_disconnect->setEnabled( false ); | 346 | m_disconnect->setEnabled( false ); |
346 | } | 347 | } |
347 | } | 348 | } |
348 | 349 | ||
349 | void MainWindow::slotTerminate() { | 350 | void MainWindow::slotTerminate() { |
350 | if ( currentSession() ) | 351 | if ( currentSession() ) |
351 | currentSession()->layer()->close(); | 352 | currentSession()->layer()->close(); |
352 | 353 | ||
353 | slotClose(); | 354 | slotClose(); |
354 | /* FIXME move to the next session */ | 355 | /* FIXME move to the next session */ |
355 | } | 356 | } |
356 | 357 | ||
357 | void MainWindow::slotConfigure() { | 358 | void MainWindow::slotConfigure() { |
358 | ConfigDialog conf( manager()->all(), factory() ); | 359 | ConfigDialog conf( manager()->all(), factory() ); |
359 | conf.showMaximized(); | 360 | conf.showMaximized(); |
360 | 361 | ||
361 | int ret = conf.exec(); | 362 | int ret = conf.exec(); |
362 | 363 | ||
363 | if ( QDialog::Accepted == ret ) { | 364 | if ( QDialog::Accepted == ret ) { |
364 | manager()->setProfiles( conf.list() ); | 365 | manager()->setProfiles( conf.list() ); |
365 | manager()->save(); | 366 | manager()->save(); |
366 | populateProfiles(); | 367 | populateProfiles(); |
367 | } | 368 | } |
368 | } | 369 | } |
369 | /* | 370 | /* |
370 | * we will remove | 371 | * we will remove |
371 | * this window from the tabwidget | 372 | * this window from the tabwidget |
372 | * remove it from the list | 373 | * remove it from the list |
373 | * delete it | 374 | * delete it |
374 | * and set the currentSession() | 375 | * and set the currentSession() |
375 | */ | 376 | */ |
376 | void MainWindow::slotClose() { | 377 | void MainWindow::slotClose() { |
377 | if (!currentSession() ) | 378 | if (!currentSession() ) |
378 | return; | 379 | return; |
379 | 380 | ||
380 | Session* ses = currentSession(); | 381 | Session* ses = currentSession(); |
381 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 382 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |