author | harlekin <harlekin> | 2002-10-24 19:16:28 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-24 19:16:28 (UTC) |
commit | 2f2f9dc5f45fe7cf194a057e104c2d54394e4cef (patch) (unidiff) | |
tree | bf9a38b4e3d09e2e145b79ecf1e5be78263c530d | |
parent | 94573faf2e89723a49bbaf3630f1d19f80ba6b27 (diff) | |
download | opie-2f2f9dc5f45fe7cf194a057e104c2d54394e4cef.zip opie-2f2f9dc5f45fe7cf194a057e104c2d54394e4cef.tar.gz opie-2f2f9dc5f45fe7cf194a057e104c2d54394e4cef.tar.bz2 |
cleanup and icon rearrangement
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 47 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 1 |
2 files changed, 17 insertions, 31 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 745efaf..44ef458 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,323 +1,310 @@ | |||
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 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 32 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
33 | KeyTrans::loadAll(); | 33 | KeyTrans::loadAll(); |
34 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 34 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
35 | KeyTrans* s = KeyTrans::find(i ); | 35 | KeyTrans* s = KeyTrans::find(i ); |
36 | assert( s ); | 36 | assert( s ); |
37 | } | 37 | } |
38 | m_factory = new MetaFactory(); | 38 | m_factory = new MetaFactory(); |
39 | Default def(m_factory); | 39 | Default def(m_factory); |
40 | m_sessions.setAutoDelete( TRUE ); | 40 | m_sessions.setAutoDelete( TRUE ); |
41 | m_curSession = 0; | 41 | m_curSession = 0; |
42 | m_manager = new ProfileManager( m_factory ); | 42 | m_manager = new ProfileManager( m_factory ); |
43 | m_manager->load(); | 43 | m_manager->load(); |
44 | 44 | ||
45 | initUI(); | 45 | initUI(); |
46 | populateProfiles(); | 46 | populateProfiles(); |
47 | } | 47 | } |
48 | void MainWindow::initUI() { | 48 | void MainWindow::initUI() { |
49 | setToolBarsMovable( FALSE ); | 49 | setToolBarsMovable( FALSE ); |
50 | 50 | ||
51 | /* tool bar for the menu */ | 51 | /* tool bar for the menu */ |
52 | m_tool = new QToolBar( this ); | 52 | m_tool = new QToolBar( this ); |
53 | m_tool->setHorizontalStretchable( TRUE ); | 53 | m_tool->setHorizontalStretchable( TRUE ); |
54 | 54 | ||
55 | m_bar = new QMenuBar( m_tool ); | 55 | m_bar = new QMenuBar( m_tool ); |
56 | m_console = new QPopupMenu( this ); | 56 | m_console = new QPopupMenu( this ); |
57 | m_scripts = new QPopupMenu( this ); | 57 | m_scripts = new QPopupMenu( this ); |
58 | m_sessionsPop= new QPopupMenu( this ); | 58 | m_sessionsPop= new QPopupMenu( this ); |
59 | //m_settings = new QPopupMenu( this ); | ||
60 | 59 | ||
61 | /* add a toolbar for icons */ | 60 | /* add a toolbar for icons */ |
62 | m_icons = new QToolBar(this); | 61 | m_icons = new QToolBar(this); |
63 | 62 | ||
64 | |||
65 | |||
66 | |||
67 | /* | 63 | /* |
68 | * the settings action | 64 | * the settings action |
69 | */ | 65 | */ |
70 | m_setProfiles = new QAction(tr("Configure Profiles"), | 66 | m_setProfiles = new QAction(tr("Configure Profiles"), |
71 | Resource::loadPixmap( "SettingsIcon" ), | 67 | Resource::loadPixmap( "SettingsIcon" ), |
72 | QString::null, 0, this, 0); | 68 | QString::null, 0, this, 0); |
73 | // m_setProfiles->addTo( m_settings ); | ||
74 | m_setProfiles->addTo( m_icons ); | ||
75 | m_setProfiles->addTo( m_console ); | 69 | m_setProfiles->addTo( m_console ); |
76 | connect( m_setProfiles, SIGNAL(activated() ), | 70 | connect( m_setProfiles, SIGNAL(activated() ), |
77 | this, SLOT(slotConfigure() ) ); | 71 | this, SLOT(slotConfigure() ) ); |
78 | 72 | ||
79 | m_console->insertSeparator(); | 73 | m_console->insertSeparator(); |
80 | /* | 74 | /* |
81 | * new Action for new sessions | 75 | * new Action for new sessions |
82 | */ | 76 | */ |
83 | QAction* a = new QAction(tr("New Connection"), | 77 | QAction* newCon = new QAction(tr("New Connection"), |
84 | Resource::loadPixmap( "new" ), | 78 | Resource::loadPixmap( "new" ), |
85 | QString::null, 0, this, 0); | 79 | QString::null, 0, this, 0); |
86 | a->addTo( m_console ); | 80 | newCon->addTo( m_console ); |
87 | a->addTo( m_icons ); | 81 | connect( newCon, SIGNAL(activated() ), |
88 | connect(a, SIGNAL(activated() ), | ||
89 | this, SLOT(slotNew() ) ); | 82 | this, SLOT(slotNew() ) ); |
90 | 83 | ||
91 | m_console->insertSeparator(); | 84 | m_console->insertSeparator(); |
92 | /* save icon is not available */ | 85 | /* save icon is not available */ |
93 | a = new QAction(tr("Save Connection"), | 86 | |
87 | QAction *saveCon = new QAction(tr("Save Connection"), | ||
94 | Resource::loadPixmap("save"), QString::null, | 88 | Resource::loadPixmap("save"), QString::null, |
95 | 0, this, 0 ); | 89 | 0, this, 0 ); |
96 | a->addTo( m_console ); | 90 | saveCon->addTo( m_console ); |
97 | connect(a, SIGNAL(activated() ), | 91 | connect( saveCon, SIGNAL(activated() ), |
98 | this, SLOT(slotSaveSession() ) ); | 92 | this, SLOT(slotSaveSession() ) ); |
99 | m_console->insertSeparator(); | 93 | m_console->insertSeparator(); |
100 | 94 | ||
101 | /* | 95 | /* |
102 | * connect action | 96 | * connect action |
103 | */ | 97 | */ |
104 | m_connect = new QAction(); | 98 | m_connect = new QAction(); |
105 | m_connect->setText( tr("Connect") ); | 99 | m_connect->setText( tr("Connect") ); |
106 | m_connect->addTo( m_console ); | 100 | m_connect->addTo( m_console ); |
107 | connect(m_connect, SIGNAL(activated() ), | 101 | connect(m_connect, SIGNAL(activated() ), |
108 | this, SLOT(slotConnect() ) ); | 102 | this, SLOT(slotConnect() ) ); |
109 | 103 | ||
110 | /* | 104 | /* |
111 | * disconnect action | 105 | * disconnect action |
112 | */ | 106 | */ |
113 | m_disconnect = new QAction(); | 107 | m_disconnect = new QAction(); |
114 | m_disconnect->setText( tr("Disconnect") ); | 108 | m_disconnect->setText( tr("Disconnect") ); |
115 | m_disconnect->addTo( m_console ); | 109 | m_disconnect->addTo( m_console ); |
116 | connect(m_disconnect, SIGNAL(activated() ), | 110 | connect(m_disconnect, SIGNAL(activated() ), |
117 | this, SLOT(slotDisconnect() ) ); | 111 | this, SLOT(slotDisconnect() ) ); |
118 | 112 | ||
119 | m_console->insertSeparator(); | 113 | m_console->insertSeparator(); |
120 | 114 | ||
121 | m_transfer = new QAction(); | 115 | m_transfer = new QAction(); |
122 | m_transfer->setText( tr("Transfer file...") ); | 116 | m_transfer->setText( tr("Transfer file...") ); |
123 | m_transfer->addTo( m_console ); | 117 | m_transfer->addTo( m_console ); |
124 | connect(m_transfer, SIGNAL(activated() ), | 118 | connect(m_transfer, SIGNAL(activated() ), |
125 | this, SLOT(slotTransfer() ) ); | 119 | this, SLOT(slotTransfer() ) ); |
126 | 120 | ||
127 | 121 | ||
128 | /* | 122 | /* |
129 | * fullscreen | 123 | * fullscreen |
130 | */ | 124 | */ |
131 | m_isFullscreen = false; | 125 | m_isFullscreen = false; |
132 | 126 | ||
133 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 127 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
134 | , QString::null, 0, this, 0); | 128 | , QString::null, 0, this, 0); |
135 | m_fullscreen->addTo( m_console ); | 129 | m_fullscreen->addTo( m_console ); |
136 | m_fullscreen->addTo( m_icons ); | ||
137 | connect( m_fullscreen, SIGNAL( activated() ), | 130 | connect( m_fullscreen, SIGNAL( activated() ), |
138 | this, SLOT( slotFullscreen() ) ); | 131 | this, SLOT( slotFullscreen() ) ); |
139 | 132 | ||
140 | m_console->insertSeparator(); | 133 | m_console->insertSeparator(); |
141 | /* | 134 | /* |
142 | * terminate action | 135 | * terminate action |
143 | */ | 136 | */ |
144 | m_terminate = new QAction(); | 137 | m_terminate = new QAction(); |
145 | m_terminate->setText( tr("Terminate") ); | 138 | m_terminate->setText( tr("Terminate") ); |
146 | m_terminate->addTo( m_console ); | 139 | m_terminate->addTo( m_console ); |
147 | connect(m_terminate, SIGNAL(activated() ), | 140 | connect(m_terminate, SIGNAL(activated() ), |
148 | this, SLOT(slotTerminate() ) ); | 141 | this, SLOT(slotTerminate() ) ); |
149 | 142 | ||
150 | m_closewindow = new QAction(); | 143 | m_closewindow = new QAction(); |
151 | m_closewindow->setText( tr("Close Window") ); | 144 | m_closewindow->setText( tr("Close Window") ); |
152 | m_closewindow->addTo( m_console ); | 145 | m_closewindow->addTo( m_console ); |
153 | connect( m_closewindow, SIGNAL(activated() ), | 146 | connect( m_closewindow, SIGNAL(activated() ), |
154 | this, SLOT(slotClose() ) ); | 147 | this, SLOT(slotClose() ) ); |
155 | 148 | ||
156 | 149 | ||
157 | /* | 150 | /* |
158 | * script actions | 151 | * script actions |
159 | */ | 152 | */ |
160 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 153 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
161 | m_recordScript->addTo(m_scripts); | 154 | m_recordScript->addTo(m_scripts); |
162 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 155 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
163 | 156 | ||
164 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 157 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
165 | m_saveScript->addTo(m_scripts); | 158 | m_saveScript->addTo(m_scripts); |
166 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 159 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
167 | 160 | ||
168 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 161 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
169 | m_runScript->addTo(m_scripts); | 162 | m_runScript->addTo(m_scripts); |
170 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 163 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
171 | 164 | ||
172 | /* | 165 | /* |
173 | * action that open/closes the keyboard | 166 | * action that open/closes the keyboard |
174 | */ | 167 | */ |
175 | m_openKeys = new QAction (tr("Open Keyboard..."), | 168 | m_openKeys = new QAction (tr("Open Keyboard..."), |
176 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 169 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
177 | QString::null, 0, this, 0); | 170 | QString::null, 0, this, 0); |
178 | |||
179 | m_openKeys->setToggleAction(true); | 171 | m_openKeys->setToggleAction(true); |
180 | 172 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); | |
181 | connect (m_openKeys, SIGNAL(toggled(bool)), | ||
182 | this, SLOT(slotOpenKeb(bool))); | ||
183 | m_openKeys->addTo(m_icons); | ||
184 | 173 | ||
185 | /* insert the submenu */ | 174 | /* insert the submenu */ |
186 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 175 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
187 | -1, 0); | 176 | -1, 0); |
188 | 177 | ||
189 | /* insert the connection menu */ | 178 | /* insert the connection menu */ |
190 | m_bar->insertItem( tr("Connection"), m_console ); | 179 | m_bar->insertItem( tr("Connection"), m_console ); |
191 | 180 | ||
192 | /* the scripts menu */ | 181 | /* the scripts menu */ |
193 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 182 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
194 | 183 | ||
195 | /* the settings menu */ | ||
196 | // m_bar->insertItem( tr("Settings"), m_settings ); | ||
197 | |||
198 | /* and the keyboard */ | 184 | /* and the keyboard */ |
199 | m_keyBar = new QToolBar(this); | 185 | m_keyBar = new QToolBar(this); |
200 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 186 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
201 | m_keyBar->setHorizontalStretchable( TRUE ); | 187 | m_keyBar->setHorizontalStretchable( TRUE ); |
202 | m_keyBar->hide(); | 188 | m_keyBar->hide(); |
203 | 189 | ||
204 | m_kb = new FunctionKeyboard(m_keyBar); | 190 | m_kb = new FunctionKeyboard(m_keyBar); |
205 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 191 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
206 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 192 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
207 | 193 | ||
208 | m_buttonBar = new QToolBar( this ); | ||
209 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | ||
210 | m_buttonBar->setHorizontalStretchable( TRUE ); | ||
211 | m_buttonBar->hide(); | ||
212 | 194 | ||
213 | a = new QAction(tr("Copy"), | 195 | QAction *a = new QAction(tr("Copy"), |
214 | Resource::loadPixmap("copy"), QString::null, | 196 | Resource::loadPixmap("copy"), QString::null, |
215 | 0, this, 0 ); | 197 | 0, this, 0 ); |
216 | //a->addTo( m_icons ); | 198 | //a->addTo( m_icons ); |
217 | connect( a, SIGNAL(activated() ), | 199 | connect( a, SIGNAL(activated() ), |
218 | this, SLOT(slotCopy() ) ); | 200 | this, SLOT(slotCopy() ) ); |
219 | 201 | ||
220 | a = new QAction(tr("Paste"), | 202 | QAction *paste = new QAction(tr("Paste"), |
221 | Resource::loadPixmap("paste"), QString::null, | 203 | Resource::loadPixmap("paste"), QString::null, |
222 | 0, this, 0 ); | 204 | 0, this, 0 ); |
223 | a->addTo( m_icons ); | 205 | connect( paste, SIGNAL(activated() ), |
224 | connect( a, SIGNAL(activated() ), | ||
225 | this, SLOT(slotPaste() ) ); | 206 | this, SLOT(slotPaste() ) ); |
226 | 207 | ||
227 | 208 | ||
209 | newCon->addTo( m_icons ); | ||
210 | m_setProfiles->addTo( m_icons ); | ||
211 | paste->addTo( m_icons ); | ||
212 | m_openKeys->addTo(m_icons); | ||
213 | m_fullscreen->addTo( m_icons ); | ||
214 | |||
228 | m_connect->setEnabled( false ); | 215 | m_connect->setEnabled( false ); |
229 | m_disconnect->setEnabled( false ); | 216 | m_disconnect->setEnabled( false ); |
230 | m_terminate->setEnabled( false ); | 217 | m_terminate->setEnabled( false ); |
231 | m_transfer->setEnabled( false ); | 218 | m_transfer->setEnabled( false ); |
232 | m_recordScript->setEnabled( false ); | 219 | m_recordScript->setEnabled( false ); |
233 | m_saveScript->setEnabled( false ); | 220 | m_saveScript->setEnabled( false ); |
234 | m_runScript->setEnabled( false ); | 221 | m_runScript->setEnabled( false ); |
235 | m_fullscreen->setEnabled( false ); | 222 | m_fullscreen->setEnabled( false ); |
236 | m_closewindow->setEnabled( false ); | 223 | m_closewindow->setEnabled( false ); |
237 | 224 | ||
238 | /* | 225 | /* |
239 | * connect to the menu activation | 226 | * connect to the menu activation |
240 | */ | 227 | */ |
241 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 228 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
242 | this, SLOT(slotProfile( int ) ) ); | 229 | this, SLOT(slotProfile( int ) ) ); |
243 | 230 | ||
244 | m_consoleWindow = new TabWidget( this, "blah"); | 231 | m_consoleWindow = new TabWidget( this, "blah"); |
245 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 232 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
246 | this, SLOT(slotSessionChanged(Session*) ) ); | 233 | this, SLOT(slotSessionChanged(Session*) ) ); |
247 | setCentralWidget( m_consoleWindow ); | 234 | setCentralWidget( m_consoleWindow ); |
248 | 235 | ||
249 | } | 236 | } |
250 | 237 | ||
251 | ProfileManager* MainWindow::manager() { | 238 | ProfileManager* MainWindow::manager() { |
252 | return m_manager; | 239 | return m_manager; |
253 | } | 240 | } |
254 | TabWidget* MainWindow::tabWidget() { | 241 | TabWidget* MainWindow::tabWidget() { |
255 | return m_consoleWindow; | 242 | return m_consoleWindow; |
256 | } | 243 | } |
257 | void MainWindow::populateProfiles() { | 244 | void MainWindow::populateProfiles() { |
258 | m_sessionsPop->clear(); | 245 | m_sessionsPop->clear(); |
259 | Profile::ValueList list = manager()->all(); | 246 | Profile::ValueList list = manager()->all(); |
260 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 247 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
261 | m_sessionsPop->insertItem( (*it).name() ); | 248 | m_sessionsPop->insertItem( (*it).name() ); |
262 | } | 249 | } |
263 | 250 | ||
264 | } | 251 | } |
265 | MainWindow::~MainWindow() { | 252 | MainWindow::~MainWindow() { |
266 | delete m_factory; | 253 | delete m_factory; |
267 | manager()->save(); | 254 | manager()->save(); |
268 | } | 255 | } |
269 | 256 | ||
270 | MetaFactory* MainWindow::factory() { | 257 | MetaFactory* MainWindow::factory() { |
271 | return m_factory; | 258 | return m_factory; |
272 | } | 259 | } |
273 | 260 | ||
274 | Session* MainWindow::currentSession() { | 261 | Session* MainWindow::currentSession() { |
275 | return m_curSession; | 262 | return m_curSession; |
276 | } | 263 | } |
277 | 264 | ||
278 | QList<Session> MainWindow::sessions() { | 265 | QList<Session> MainWindow::sessions() { |
279 | return m_sessions; | 266 | return m_sessions; |
280 | } | 267 | } |
281 | 268 | ||
282 | void MainWindow::slotNew() { | 269 | void MainWindow::slotNew() { |
283 | ProfileEditorDialog dlg(factory() ); | 270 | ProfileEditorDialog dlg(factory() ); |
284 | dlg.showMaximized(); | 271 | dlg.showMaximized(); |
285 | int ret = dlg.exec(); | 272 | int ret = dlg.exec(); |
286 | 273 | ||
287 | if ( ret == QDialog::Accepted ) { | 274 | if ( ret == QDialog::Accepted ) { |
288 | create( dlg.profile() ); | 275 | create( dlg.profile() ); |
289 | } | 276 | } |
290 | } | 277 | } |
291 | 278 | ||
292 | void MainWindow::slotRecordScript() { | 279 | void MainWindow::slotRecordScript() { |
293 | if (currentSession()) { | 280 | if (currentSession()) { |
294 | currentSession()->emulationHandler()->startRecording(); | 281 | currentSession()->emulationHandler()->startRecording(); |
295 | } | 282 | } |
296 | } | 283 | } |
297 | 284 | ||
298 | void MainWindow::slotSaveScript() { | 285 | void MainWindow::slotSaveScript() { |
299 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 286 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
300 | MimeTypes types; | 287 | MimeTypes types; |
301 | QStringList script; | 288 | QStringList script; |
302 | script << "text/plain"; | 289 | script << "text/plain"; |
303 | script << "text/all"; | 290 | script << "text/all"; |
304 | script << "application/octet-stream"; | 291 | script << "application/octet-stream"; |
305 | types.insert("Script", script); | 292 | types.insert("Script", script); |
306 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 293 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
307 | if (!filename.isEmpty()) { | 294 | if (!filename.isEmpty()) { |
308 | currentSession()->emulationHandler()->script()->saveTo(filename); | 295 | currentSession()->emulationHandler()->script()->saveTo(filename); |
309 | currentSession()->emulationHandler()->clearScript(); | 296 | currentSession()->emulationHandler()->clearScript(); |
310 | } | 297 | } |
311 | } | 298 | } |
312 | } | 299 | } |
313 | 300 | ||
314 | void MainWindow::slotRunScript() { | 301 | void MainWindow::slotRunScript() { |
315 | if (currentSession()) { | 302 | if (currentSession()) { |
316 | MimeTypes types; | 303 | MimeTypes types; |
317 | QStringList script; | 304 | QStringList script; |
318 | script << "text/plain"; | 305 | script << "text/plain"; |
319 | script << "text/all"; | 306 | script << "text/all"; |
320 | script << "application/octet-stream"; | 307 | script << "application/octet-stream"; |
321 | types.insert("Script", script); | 308 | types.insert("Script", script); |
322 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 309 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
323 | if (!filename.isEmpty()) { | 310 | if (!filename.isEmpty()) { |
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 7cc2aa5..19d3a3d 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -11,120 +11,119 @@ | |||
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 FKey; | 23 | class FKey; |
24 | 24 | ||
25 | 25 | ||
26 | class MainWindow : public QMainWindow { | 26 | class MainWindow : public QMainWindow { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | public: | 28 | public: |
29 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); | 29 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); |
30 | ~MainWindow(); | 30 | ~MainWindow(); |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * our factory to generate IOLayer and so on | 33 | * our factory to generate IOLayer and so on |
34 | * | 34 | * |
35 | */ | 35 | */ |
36 | MetaFactory* factory(); | 36 | MetaFactory* factory(); |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * A session contains a QWidget*, | 39 | * A session contains a QWidget*, |
40 | * an IOLayer* and some infos for us | 40 | * an IOLayer* and some infos for us |
41 | */ | 41 | */ |
42 | Session* currentSession(); | 42 | Session* currentSession(); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * the session list | 45 | * the session list |
46 | */ | 46 | */ |
47 | QList<Session> sessions(); | 47 | QList<Session> sessions(); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * | 50 | * |
51 | */ | 51 | */ |
52 | ProfileManager* manager(); | 52 | ProfileManager* manager(); |
53 | TabWidget* tabWidget(); | 53 | TabWidget* tabWidget(); |
54 | 54 | ||
55 | private slots: | 55 | private slots: |
56 | void slotNew(); | 56 | void slotNew(); |
57 | void slotConnect(); | 57 | void slotConnect(); |
58 | void slotDisconnect(); | 58 | void slotDisconnect(); |
59 | void slotTerminate(); | 59 | void slotTerminate(); |
60 | void slotConfigure(); | 60 | void slotConfigure(); |
61 | void slotClose(); | 61 | void slotClose(); |
62 | void slotProfile(int); | 62 | void slotProfile(int); |
63 | void slotTransfer(); | 63 | void slotTransfer(); |
64 | void slotOpenKeb(bool); | 64 | void slotOpenKeb(bool); |
65 | void slotOpenButtons(bool); | 65 | void slotOpenButtons(bool); |
66 | void slotRecordScript(); | 66 | void slotRecordScript(); |
67 | void slotSaveScript(); | 67 | void slotSaveScript(); |
68 | void slotRunScript(); | 68 | void slotRunScript(); |
69 | void slotFullscreen(); | 69 | void slotFullscreen(); |
70 | void slotSessionChanged( Session* ); | 70 | void slotSessionChanged( Session* ); |
71 | void slotKeyReceived(FKey, ushort, ushort, bool); | 71 | void slotKeyReceived(FKey, ushort, ushort, bool); |
72 | 72 | ||
73 | /* what could these both slot do? */ | 73 | /* what could these both slot do? */ |
74 | void slotCopy(); | 74 | void slotCopy(); |
75 | void slotPaste(); | 75 | void slotPaste(); |
76 | 76 | ||
77 | /* save the currentSession() to Profiles */ | 77 | /* save the currentSession() to Profiles */ |
78 | void slotSaveSession(); | 78 | void slotSaveSession(); |
79 | 79 | ||
80 | private: | 80 | private: |
81 | void initUI(); | 81 | void initUI(); |
82 | void populateProfiles(); | 82 | void populateProfiles(); |
83 | void create( const Profile& ); | 83 | void create( const Profile& ); |
84 | /** | 84 | /** |
85 | * the current session | 85 | * the current session |
86 | */ | 86 | */ |
87 | Session* m_curSession; | 87 | Session* m_curSession; |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * the session list | 90 | * the session list |
91 | */ | 91 | */ |
92 | QList<Session> m_sessions; | 92 | QList<Session> m_sessions; |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * the metafactory | 95 | * the metafactory |
96 | */ | 96 | */ |
97 | MetaFactory* m_factory; | 97 | MetaFactory* m_factory; |
98 | ProfileManager* m_manager; | 98 | ProfileManager* m_manager; |
99 | 99 | ||
100 | TabWidget* m_consoleWindow; | 100 | TabWidget* m_consoleWindow; |
101 | QToolBar* m_tool; | 101 | QToolBar* m_tool; |
102 | QToolBar* m_icons; | 102 | QToolBar* m_icons; |
103 | QToolBar* m_keyBar; | 103 | QToolBar* m_keyBar; |
104 | QToolBar* m_buttonBar; | 104 | QToolBar* m_buttonBar; |
105 | QMenuBar* m_bar; | 105 | QMenuBar* m_bar; |
106 | QPopupMenu* m_console; | 106 | QPopupMenu* m_console; |
107 | QPopupMenu* m_settings; | ||
108 | QPopupMenu* m_sessionsPop; | 107 | QPopupMenu* m_sessionsPop; |
109 | QPopupMenu* m_scripts; | 108 | QPopupMenu* m_scripts; |
110 | QAction* m_connect; | 109 | QAction* m_connect; |
111 | QAction* m_disconnect; | 110 | QAction* m_disconnect; |
112 | QAction* m_terminate; | 111 | QAction* m_terminate; |
113 | QAction* m_transfer; | 112 | QAction* m_transfer; |
114 | QAction* m_setProfiles; | 113 | QAction* m_setProfiles; |
115 | QAction* m_openKeys; | 114 | QAction* m_openKeys; |
116 | QAction* m_openButtons; | 115 | QAction* m_openButtons; |
117 | QAction* m_recordScript; | 116 | QAction* m_recordScript; |
118 | QAction* m_saveScript; | 117 | QAction* m_saveScript; |
119 | QAction* m_runScript; | 118 | QAction* m_runScript; |
120 | QAction* m_fullscreen; | 119 | QAction* m_fullscreen; |
121 | QAction* m_closewindow; | 120 | QAction* m_closewindow; |
122 | 121 | ||
123 | FunctionKeyboard *m_kb; | 122 | FunctionKeyboard *m_kb; |
124 | bool m_isFullscreen; | 123 | bool m_isFullscreen; |
125 | 124 | ||
126 | QWidget* savedParentFullscreen; | 125 | QWidget* savedParentFullscreen; |
127 | }; | 126 | }; |
128 | 127 | ||
129 | 128 | ||
130 | #endif | 129 | #endif |