author | harlekin <harlekin> | 2002-10-14 23:23:55 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-14 23:23:55 (UTC) |
commit | c7aed90e02d06502dff04043103c5db0883cc011 (patch) (unidiff) | |
tree | 1787c9d92e23474d2e69bb1607ecaf565cac2475 | |
parent | 91adb54066037522a619ce5d072c2e932901fd74 (diff) | |
download | opie-c7aed90e02d06502dff04043103c5db0883cc011.zip opie-c7aed90e02d06502dff04043103c5db0883cc011.tar.gz opie-c7aed90e02d06502dff04043103c5db0883cc011.tar.bz2 |
half way fullscreen done
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 101 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 7 |
2 files changed, 88 insertions, 20 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 89cdf51..6dc9e6e 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,228 +1,267 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | 3 | ||
4 | 4 | ||
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qmenubar.h> | 6 | #include <qmenubar.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
9 | #include <qtoolbar.h> | 9 | #include <qtoolbar.h> |
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | #include <qpushbutton.h> | ||
11 | 12 | ||
12 | #include <qpe/resource.h> | 13 | #include <qpe/resource.h> |
13 | #include <opie/ofiledialog.h> | 14 | #include <opie/ofiledialog.h> |
14 | 15 | ||
15 | 16 | ||
16 | #include "keytrans.h" | 17 | #include "keytrans.h" |
17 | #include "profileeditordialog.h" | 18 | #include "profileeditordialog.h" |
18 | #include "configdialog.h" | 19 | #include "configdialog.h" |
19 | #include "default.h" | 20 | #include "default.h" |
20 | #include "metafactory.h" | 21 | #include "metafactory.h" |
21 | #include "profile.h" | 22 | #include "profile.h" |
22 | #include "profilemanager.h" | 23 | #include "profilemanager.h" |
23 | #include "mainwindow.h" | 24 | #include "mainwindow.h" |
24 | #include "tabwidget.h" | 25 | #include "tabwidget.h" |
25 | #include "transferdialog.h" | 26 | #include "transferdialog.h" |
26 | #include "function_keyboard.h" | 27 | #include "function_keyboard.h" |
27 | #include "script.h" | 28 | #include "script.h" |
28 | 29 | ||
30 | |||
31 | |||
32 | static char * menu_xpm[] = { | ||
33 | "12 12 5 1", | ||
34 | " c None", | ||
35 | ".c #000000", | ||
36 | "+c #FFFDAD", | ||
37 | "@c #FFFF00", | ||
38 | "#c #E5E100", | ||
39 | " ", | ||
40 | " ", | ||
41 | " ......... ", | ||
42 | " .+++++++. ", | ||
43 | " .+@@@@#. ", | ||
44 | " .+@@@#. ", | ||
45 | " .+@@#. ", | ||
46 | " .+@#. ", | ||
47 | " .+#. ", | ||
48 | " .+. ", | ||
49 | " .. ", | ||
50 | " "}; | ||
51 | |||
52 | |||
29 | MainWindow::MainWindow() { | 53 | MainWindow::MainWindow() { |
30 | KeyTrans::loadAll(); | 54 | KeyTrans::loadAll(); |
31 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 55 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
32 | KeyTrans* s = KeyTrans::find(i ); | 56 | KeyTrans* s = KeyTrans::find(i ); |
33 | assert( s ); | 57 | assert( s ); |
34 | } | 58 | } |
35 | m_factory = new MetaFactory(); | 59 | m_factory = new MetaFactory(); |
36 | Default def(m_factory); | 60 | Default def(m_factory); |
37 | m_sessions.setAutoDelete( TRUE ); | 61 | m_sessions.setAutoDelete( TRUE ); |
38 | m_curSession = 0; | 62 | m_curSession = 0; |
39 | m_manager = new ProfileManager( m_factory ); | 63 | m_manager = new ProfileManager( m_factory ); |
40 | m_manager->load(); | 64 | m_manager->load(); |
41 | 65 | ||
42 | initUI(); | 66 | initUI(); |
43 | populateProfiles(); | 67 | populateProfiles(); |
44 | } | 68 | } |
45 | void MainWindow::initUI() { | 69 | void MainWindow::initUI() { |
46 | setToolBarsMovable( FALSE ); | 70 | setToolBarsMovable( FALSE ); |
47 | 71 | ||
48 | /* tool bar for the menu */ | 72 | /* tool bar for the menu */ |
49 | m_tool = new QToolBar( this ); | 73 | m_tool = new QToolBar( this ); |
50 | m_tool->setHorizontalStretchable( TRUE ); | 74 | m_tool->setHorizontalStretchable( TRUE ); |
51 | 75 | ||
52 | m_bar = new QMenuBar( m_tool ); | 76 | m_bar = new QMenuBar( m_tool ); |
53 | m_console = new QPopupMenu( this ); | 77 | m_console = new QPopupMenu( this ); |
54 | m_scripts = new QPopupMenu( this ); | 78 | m_scripts = new QPopupMenu( this ); |
55 | m_sessionsPop= new QPopupMenu( this ); | 79 | m_sessionsPop= new QPopupMenu( this ); |
56 | m_settings = new QPopupMenu( this ); | 80 | m_settings = new QPopupMenu( this ); |
57 | 81 | ||
58 | /* add a toolbar for icons */ | 82 | /* add a toolbar for icons */ |
59 | m_icons = new QToolBar(this); | 83 | m_icons = new QToolBar(this); |
60 | 84 | ||
61 | /* | 85 | /* |
62 | * new Action for new sessions | 86 | * new Action for new sessions |
63 | */ | 87 | */ |
64 | QAction* a = new QAction(tr("New Connection"), | 88 | QAction* a = new QAction(tr("New Connection"), |
65 | Resource::loadPixmap( "new" ), | 89 | Resource::loadPixmap( "new" ), |
66 | QString::null, 0, this, 0); | 90 | QString::null, 0, this, 0); |
67 | a->addTo( m_console ); | 91 | a->addTo( m_console ); |
68 | a->addTo( m_icons ); | 92 | a->addTo( m_icons ); |
69 | connect(a, SIGNAL(activated() ), | 93 | connect(a, SIGNAL(activated() ), |
70 | this, SLOT(slotNew() ) ); | 94 | this, SLOT(slotNew() ) ); |
71 | 95 | ||
72 | /* | 96 | /* |
73 | * connect action | 97 | * connect action |
74 | */ | 98 | */ |
75 | m_connect = new QAction(); | 99 | m_connect = new QAction(); |
76 | m_connect->setText( tr("Connect") ); | 100 | m_connect->setText( tr("Connect") ); |
77 | m_connect->addTo( m_console ); | 101 | m_connect->addTo( m_console ); |
78 | connect(m_connect, SIGNAL(activated() ), | 102 | connect(m_connect, SIGNAL(activated() ), |
79 | this, SLOT(slotConnect() ) ); | 103 | this, SLOT(slotConnect() ) ); |
80 | 104 | ||
81 | /* | 105 | /* |
82 | * disconnect action | 106 | * disconnect action |
83 | */ | 107 | */ |
84 | m_disconnect = new QAction(); | 108 | m_disconnect = new QAction(); |
85 | m_disconnect->setText( tr("Disconnect") ); | 109 | m_disconnect->setText( tr("Disconnect") ); |
86 | m_disconnect->addTo( m_console ); | 110 | m_disconnect->addTo( m_console ); |
87 | connect(m_disconnect, SIGNAL(activated() ), | 111 | connect(m_disconnect, SIGNAL(activated() ), |
88 | this, SLOT(slotDisconnect() ) ); | 112 | this, SLOT(slotDisconnect() ) ); |
89 | 113 | ||
90 | m_transfer = new QAction(); | 114 | m_transfer = new QAction(); |
91 | m_transfer->setText( tr("Transfer file...") ); | 115 | m_transfer->setText( tr("Transfer file...") ); |
92 | m_transfer->addTo( m_console ); | 116 | m_transfer->addTo( m_console ); |
93 | connect(m_transfer, SIGNAL(activated() ), | 117 | connect(m_transfer, SIGNAL(activated() ), |
94 | this, SLOT(slotTransfer() ) ); | 118 | this, SLOT(slotTransfer() ) ); |
95 | 119 | ||
120 | |||
121 | /* | ||
122 | * fullscreen | ||
123 | */ | ||
124 | m_isFullscreen = false; | ||
125 | |||
126 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | ||
127 | , QString::null, 0, this, 0); | ||
128 | m_fullscreen->addTo( m_console ); | ||
129 | m_fullscreen->addTo( m_icons ); | ||
130 | connect( m_fullscreen, SIGNAL( activated() ), | ||
131 | this, SLOT( slotFullscreen() ) ); | ||
132 | |||
96 | /* | 133 | /* |
97 | * terminate action | 134 | * terminate action |
98 | */ | 135 | */ |
99 | m_terminate = new QAction(); | 136 | m_terminate = new QAction(); |
100 | m_terminate->setText( tr("Terminate") ); | 137 | m_terminate->setText( tr("Terminate") ); |
101 | m_terminate->addTo( m_console ); | 138 | m_terminate->addTo( m_console ); |
102 | connect(m_terminate, SIGNAL(activated() ), | 139 | connect(m_terminate, SIGNAL(activated() ), |
103 | this, SLOT(slotTerminate() ) ); | 140 | this, SLOT(slotTerminate() ) ); |
104 | 141 | ||
105 | a = new QAction(); | 142 | m_closewindow = new QAction(); |
106 | a->setText( tr("Close Window") ); | 143 | m_closewindow->setText( tr("Close Window") ); |
107 | a->addTo( m_console ); | 144 | m_closewindow->addTo( m_console ); |
108 | connect(a, SIGNAL(activated() ), | 145 | connect( m_closewindow, SIGNAL(activated() ), |
109 | this, SLOT(slotClose() ) ); | 146 | this, SLOT(slotClose() ) ); |
110 | 147 | ||
111 | /* | 148 | /* |
112 | * the settings action | 149 | * the settings action |
113 | */ | 150 | */ |
114 | m_setProfiles = new QAction(tr("Configure Profiles"), | 151 | m_setProfiles = new QAction(tr("Configure Profiles"), |
115 | Resource::loadPixmap( "SettingsIcon" ), | 152 | Resource::loadPixmap( "SettingsIcon" ), |
116 | QString::null, 0, this, 0); | 153 | QString::null, 0, this, 0); |
117 | m_setProfiles->addTo( m_settings ); | 154 | m_setProfiles->addTo( m_settings ); |
118 | m_setProfiles->addTo( m_icons ); | 155 | m_setProfiles->addTo( m_icons ); |
119 | connect( m_setProfiles, SIGNAL(activated() ), | 156 | connect( m_setProfiles, SIGNAL(activated() ), |
120 | this, SLOT(slotConfigure() ) ); | 157 | this, SLOT(slotConfigure() ) ); |
121 | 158 | ||
122 | /* | 159 | /* |
123 | * script actions | 160 | * script actions |
124 | */ | 161 | */ |
125 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 162 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
126 | m_recordScript->addTo(m_scripts); | 163 | m_recordScript->addTo(m_scripts); |
127 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 164 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
128 | 165 | ||
129 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 166 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
130 | m_saveScript->addTo(m_scripts); | 167 | m_saveScript->addTo(m_scripts); |
131 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 168 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
132 | 169 | ||
133 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 170 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
134 | m_runScript->addTo(m_scripts); | 171 | m_runScript->addTo(m_scripts); |
135 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 172 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
136 | 173 | ||
137 | /* | 174 | /* |
138 | * action that open/closes the keyboard | 175 | * action that open/closes the keyboard |
139 | */ | 176 | */ |
140 | m_openKeys = new QAction (tr("Open Keyboard..."), | 177 | m_openKeys = new QAction (tr("Open Keyboard..."), |
141 | Resource::loadPixmap( "down" ), | 178 | Resource::loadPixmap( "down" ), |
142 | QString::null, 0, this, 0); | 179 | QString::null, 0, this, 0); |
143 | 180 | ||
144 | m_openKeys->setToggleAction(true); | 181 | m_openKeys->setToggleAction(true); |
145 | 182 | ||
146 | connect (m_openKeys, SIGNAL(toggled(bool)), | 183 | connect (m_openKeys, SIGNAL(toggled(bool)), |
147 | this, SLOT(slotOpenKeb(bool))); | 184 | this, SLOT(slotOpenKeb(bool))); |
148 | m_openKeys->addTo(m_icons); | 185 | m_openKeys->addTo(m_icons); |
149 | 186 | ||
150 | 187 | ||
151 | /* insert the submenu */ | 188 | /* insert the submenu */ |
152 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 189 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
153 | -1, 0); | 190 | -1, 0); |
154 | 191 | ||
155 | /* insert the connection menu */ | 192 | /* insert the connection menu */ |
156 | m_bar->insertItem( tr("Connection"), m_console ); | 193 | m_bar->insertItem( tr("Connection"), m_console ); |
157 | 194 | ||
158 | /* the scripts menu */ | 195 | /* the scripts menu */ |
159 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 196 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
160 | 197 | ||
161 | /* the settings menu */ | 198 | /* the settings menu */ |
162 | m_bar->insertItem( tr("Settings"), m_settings ); | 199 | m_bar->insertItem( tr("Settings"), m_settings ); |
163 | 200 | ||
164 | /* and the keyboard */ | 201 | /* and the keyboard */ |
165 | m_keyBar = new QToolBar(this); | 202 | m_keyBar = new QToolBar(this); |
166 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 203 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
167 | m_keyBar->setHorizontalStretchable( TRUE ); | 204 | m_keyBar->setHorizontalStretchable( TRUE ); |
168 | m_keyBar->hide(); | 205 | m_keyBar->hide(); |
169 | 206 | ||
170 | m_kb = new FunctionKeyboard(m_keyBar); | 207 | m_kb = new FunctionKeyboard(m_keyBar); |
171 | 208 | ||
172 | 209 | ||
173 | 210 | ||
174 | m_connect->setEnabled( false ); | 211 | m_connect->setEnabled( false ); |
175 | m_disconnect->setEnabled( false ); | 212 | m_disconnect->setEnabled( false ); |
176 | m_terminate->setEnabled( false ); | 213 | m_terminate->setEnabled( false ); |
177 | m_transfer->setEnabled( false ); | 214 | m_transfer->setEnabled( false ); |
178 | m_recordScript->setEnabled( false ); | 215 | m_recordScript->setEnabled( false ); |
179 | m_saveScript->setEnabled( false ); | 216 | m_saveScript->setEnabled( false ); |
180 | m_runScript->setEnabled( false ); | 217 | m_runScript->setEnabled( false ); |
218 | m_fullscreen->setEnabled( false ); | ||
219 | m_closewindow->setEnabled( false ); | ||
181 | 220 | ||
182 | /* | 221 | /* |
183 | * connect to the menu activation | 222 | * connect to the menu activation |
184 | */ | 223 | */ |
185 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 224 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
186 | this, SLOT(slotProfile( int ) ) ); | 225 | this, SLOT(slotProfile( int ) ) ); |
187 | 226 | ||
188 | m_consoleWindow = new TabWidget( this, "blah"); | 227 | m_consoleWindow = new TabWidget( this, "blah"); |
189 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 228 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
190 | this, SLOT(slotSessionChanged(Session*) ) ); | 229 | this, SLOT(slotSessionChanged(Session*) ) ); |
191 | setCentralWidget( m_consoleWindow ); | 230 | setCentralWidget( m_consoleWindow ); |
192 | 231 | ||
193 | } | 232 | } |
194 | 233 | ||
195 | ProfileManager* MainWindow::manager() { | 234 | ProfileManager* MainWindow::manager() { |
196 | return m_manager; | 235 | return m_manager; |
197 | } | 236 | } |
198 | TabWidget* MainWindow::tabWidget() { | 237 | TabWidget* MainWindow::tabWidget() { |
199 | return m_consoleWindow; | 238 | return m_consoleWindow; |
200 | } | 239 | } |
201 | void MainWindow::populateProfiles() { | 240 | void MainWindow::populateProfiles() { |
202 | m_sessionsPop->clear(); | 241 | m_sessionsPop->clear(); |
203 | Profile::ValueList list = manager()->all(); | 242 | Profile::ValueList list = manager()->all(); |
204 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 243 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
205 | m_sessionsPop->insertItem( (*it).name() ); | 244 | m_sessionsPop->insertItem( (*it).name() ); |
206 | } | 245 | } |
207 | 246 | ||
208 | } | 247 | } |
209 | MainWindow::~MainWindow() { | 248 | MainWindow::~MainWindow() { |
210 | delete m_factory; | 249 | delete m_factory; |
211 | manager()->save(); | 250 | manager()->save(); |
212 | } | 251 | } |
213 | 252 | ||
214 | MetaFactory* MainWindow::factory() { | 253 | MetaFactory* MainWindow::factory() { |
215 | return m_factory; | 254 | return m_factory; |
216 | } | 255 | } |
217 | 256 | ||
218 | Session* MainWindow::currentSession() { | 257 | Session* MainWindow::currentSession() { |
219 | return m_curSession; | 258 | return m_curSession; |
220 | } | 259 | } |
221 | 260 | ||
222 | QList<Session> MainWindow::sessions() { | 261 | QList<Session> MainWindow::sessions() { |
223 | return m_sessions; | 262 | return m_sessions; |
224 | } | 263 | } |
225 | 264 | ||
226 | void MainWindow::slotNew() { | 265 | void MainWindow::slotNew() { |
227 | qWarning("New Connection"); | 266 | qWarning("New Connection"); |
228 | ProfileEditorDialog dlg(factory() ); | 267 | ProfileEditorDialog dlg(factory() ); |
@@ -280,124 +319,150 @@ void MainWindow::slotConnect() { | |||
280 | QObject::tr("Connecting failed for this session.")); | 319 | QObject::tr("Connecting failed for this session.")); |
281 | } | 320 | } |
282 | } | 321 | } |
283 | 322 | ||
284 | void MainWindow::slotDisconnect() { | 323 | void MainWindow::slotDisconnect() { |
285 | if ( currentSession() ) | 324 | if ( currentSession() ) |
286 | currentSession()->layer()->close(); | 325 | currentSession()->layer()->close(); |
287 | } | 326 | } |
288 | 327 | ||
289 | void MainWindow::slotTerminate() { | 328 | void MainWindow::slotTerminate() { |
290 | if ( currentSession() ) | 329 | if ( currentSession() ) |
291 | currentSession()->layer()->close(); | 330 | currentSession()->layer()->close(); |
292 | 331 | ||
293 | slotClose(); | 332 | slotClose(); |
294 | /* FIXME move to the next session */ | 333 | /* FIXME move to the next session */ |
295 | } | 334 | } |
296 | 335 | ||
297 | void MainWindow::slotConfigure() { | 336 | void MainWindow::slotConfigure() { |
298 | qWarning("configure"); | 337 | qWarning("configure"); |
299 | ConfigDialog conf( manager()->all(), factory() ); | 338 | ConfigDialog conf( manager()->all(), factory() ); |
300 | conf.showMaximized(); | 339 | conf.showMaximized(); |
301 | 340 | ||
302 | int ret = conf.exec(); | 341 | int ret = conf.exec(); |
303 | 342 | ||
304 | if ( QDialog::Accepted == ret ) { | 343 | if ( QDialog::Accepted == ret ) { |
305 | qWarning("conf %d", conf.list().count() ); | 344 | qWarning("conf %d", conf.list().count() ); |
306 | manager()->setProfiles( conf.list() ); | 345 | manager()->setProfiles( conf.list() ); |
307 | manager()->save(); | 346 | manager()->save(); |
308 | populateProfiles(); | 347 | populateProfiles(); |
309 | } | 348 | } |
310 | } | 349 | } |
311 | /* | 350 | /* |
312 | * we will remove | 351 | * we will remove |
313 | * this window from the tabwidget | 352 | * this window from the tabwidget |
314 | * remove it from the list | 353 | * remove it from the list |
315 | * delete it | 354 | * delete it |
316 | * and set the currentSession() | 355 | * and set the currentSession() |
317 | */ | 356 | */ |
318 | void MainWindow::slotClose() { | 357 | void MainWindow::slotClose() { |
319 | qWarning("close"); | 358 | qWarning("close"); |
320 | if (!currentSession() ) | 359 | if (!currentSession() ) |
321 | return; | 360 | return; |
322 | 361 | ||
323 | tabWidget()->remove( currentSession() ); | 362 | tabWidget()->remove( currentSession() ); |
324 | /*it's autodelete */ | 363 | /*it's autodelete */ |
325 | m_sessions.remove( m_curSession ); | 364 | m_sessions.remove( m_curSession ); |
326 | m_curSession = m_sessions.first(); | 365 | m_curSession = m_sessions.first(); |
327 | tabWidget()->setCurrent( m_curSession ); | 366 | tabWidget()->setCurrent( m_curSession ); |
367 | |||
368 | if (!currentSession() ) { | ||
369 | m_connect->setEnabled( false ); | ||
370 | m_disconnect->setEnabled( false ); | ||
371 | m_terminate->setEnabled( false ); | ||
372 | m_transfer->setEnabled( false ); | ||
373 | m_recordScript->setEnabled( false ); | ||
374 | m_saveScript->setEnabled( false ); | ||
375 | m_runScript->setEnabled( false ); | ||
376 | m_fullscreen->setEnabled( false ); | ||
377 | m_closewindow->setEnabled( false ); | ||
378 | } | ||
328 | } | 379 | } |
329 | 380 | ||
330 | /* | 381 | /* |
331 | * We will get the name | 382 | * We will get the name |
332 | * Then the profile | 383 | * Then the profile |
333 | * and then we will make a profile | 384 | * and then we will make a profile |
334 | */ | 385 | */ |
335 | void MainWindow::slotProfile( int id) { | 386 | void MainWindow::slotProfile( int id) { |
336 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 387 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
337 | create( prof ); | 388 | create( prof ); |
338 | } | 389 | } |
339 | void MainWindow::create( const Profile& prof ) { | 390 | void MainWindow::create( const Profile& prof ) { |
340 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 391 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
341 | 392 | ||
342 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 393 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
343 | { | 394 | { |
344 | QMessageBox::warning(this, | 395 | QMessageBox::warning(this, |
345 | QObject::tr("Session failed"), | 396 | QObject::tr("Session failed"), |
346 | QObject::tr("Cannot open session: Not all components were found.")); | 397 | QObject::tr("Cannot open session: Not all components were found.")); |
347 | //if(ses) delete ses; | 398 | //if(ses) delete ses; |
348 | return; | 399 | return; |
349 | } | 400 | } |
350 | 401 | ||
351 | m_sessions.append( ses ); | 402 | m_sessions.append( ses ); |
352 | tabWidget()->add( ses ); | 403 | tabWidget()->add( ses ); |
353 | m_curSession = ses; | 404 | m_curSession = ses; |
354 | 405 | ||
355 | // dicide if its a local term ( then no connction and no tranfer) | 406 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
356 | m_connect->setEnabled( true ); | 407 | m_connect->setEnabled( true ); |
357 | m_disconnect->setEnabled( true ); | 408 | m_disconnect->setEnabled( true ); |
358 | m_terminate->setEnabled( true ); | 409 | m_terminate->setEnabled( true ); |
359 | m_transfer->setEnabled( true ); | 410 | m_transfer->setEnabled( true ); |
360 | m_recordScript->setEnabled( true ); | 411 | m_recordScript->setEnabled( true ); |
361 | m_saveScript->setEnabled( true ); | 412 | m_saveScript->setEnabled( true ); |
362 | m_runScript->setEnabled( true ); | 413 | m_runScript->setEnabled( true ); |
363 | 414 | m_fullscreen->setEnabled( true ); | |
364 | 415 | m_closewindow->setEnabled( true ); | |
365 | } | 416 | } |
366 | 417 | ||
367 | void MainWindow::slotTransfer() | 418 | void MainWindow::slotTransfer() |
368 | { | 419 | { |
369 | // if ( currentSession() ) { | 420 | // if ( currentSession() ) { |
370 | TransferDialog dlg(this); | 421 | TransferDialog dlg(this); |
371 | dlg.showMaximized(); | 422 | dlg.showMaximized(); |
372 | dlg.exec(); | 423 | dlg.exec(); |
373 | // } | 424 | // } |
374 | } | 425 | } |
375 | 426 | ||
376 | 427 | ||
377 | void MainWindow::slotOpenKeb(bool state) { | 428 | void MainWindow::slotOpenKeb(bool state) { |
378 | 429 | ||
379 | if (state) m_keyBar->show(); | 430 | if (state) m_keyBar->show(); |
380 | else m_keyBar->hide(); | 431 | else m_keyBar->hide(); |
381 | 432 | ||
382 | } | 433 | } |
383 | void MainWindow::slotSessionChanged( Session* ses ) { | 434 | void MainWindow::slotSessionChanged( Session* ses ) { |
384 | if ( ses ) { | 435 | if ( ses ) { |
385 | qWarning("changing %s", ses->name().latin1() ); | 436 | qWarning("changing %s", ses->name().latin1() ); |
386 | m_curSession = ses; | 437 | m_curSession = ses; |
387 | } | 438 | } |
388 | } | 439 | } |
389 | 440 | ||
390 | void MainWindow::setOn() { | 441 | void MainWindow::slotFullscreen() { |
391 | 442 | ||
392 | /* | 443 | if ( m_isFullscreen ) { |
393 | m_connect | 444 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); |
394 | m_disconnect | 445 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
395 | m_terminate | 446 | setCentralWidget( m_consoleWindow ); |
396 | m_transfer | 447 | ( m_curSession->widgetStack() )->show(); |
397 | m_recordScript | 448 | m_fullscreen->setText( tr("Full screen") ); |
398 | m_saveScript | 449 | |
399 | m_runScript | 450 | } else { |
400 | */ | 451 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
452 | ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, | ||
453 | QPoint(0,0), false); | ||
454 | ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height()); | ||
455 | ( m_curSession->widgetStack() )->setFocus(); | ||
456 | ( m_curSession->widgetStack() )->show(); | ||
457 | |||
458 | // QPushButton *cornerButton = new QPushButton( this ); | ||
459 | //cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); | ||
460 | //connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | ||
461 | // need teh scrollbar | ||
462 | // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton ); | ||
463 | m_fullscreen->setText( tr("Stop full screen") ); | ||
464 | } | ||
401 | 465 | ||
466 | m_isFullscreen = !m_isFullscreen; | ||
402 | 467 | ||
403 | } | 468 | } |
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 378870a..e63078a 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -12,99 +12,102 @@ | |||
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 setOn(); | 65 | void slotFullscreen(); |
66 | void slotSessionChanged( Session* ); | 66 | void slotSessionChanged( Session* ); |
67 | private: | 67 | private: |
68 | void initUI(); | 68 | void initUI(); |
69 | void populateProfiles(); | 69 | void populateProfiles(); |
70 | void create( const Profile& ); | 70 | void create( const Profile& ); |
71 | /** | 71 | /** |
72 | * the current session | 72 | * the current session |
73 | */ | 73 | */ |
74 | Session* m_curSession; | 74 | Session* m_curSession; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * the session list | 77 | * the session list |
78 | */ | 78 | */ |
79 | QList<Session> m_sessions; | 79 | QList<Session> m_sessions; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * the metafactory | 82 | * the metafactory |
83 | */ | 83 | */ |
84 | MetaFactory* m_factory; | 84 | MetaFactory* m_factory; |
85 | ProfileManager* m_manager; | 85 | ProfileManager* m_manager; |
86 | 86 | ||
87 | TabWidget* m_consoleWindow; | 87 | TabWidget* m_consoleWindow; |
88 | QToolBar* m_tool; | 88 | QToolBar* m_tool; |
89 | QToolBar* m_icons; | 89 | QToolBar* m_icons; |
90 | QToolBar* m_keyBar; | 90 | QToolBar* m_keyBar; |
91 | QMenuBar* m_bar; | 91 | QMenuBar* m_bar; |
92 | QPopupMenu* m_console; | 92 | QPopupMenu* m_console; |
93 | QPopupMenu* m_settings; | 93 | QPopupMenu* m_settings; |
94 | QPopupMenu* m_sessionsPop; | 94 | QPopupMenu* m_sessionsPop; |
95 | QPopupMenu* m_scripts; | 95 | QPopupMenu* m_scripts; |
96 | QAction* m_connect; | 96 | QAction* m_connect; |
97 | QAction* m_disconnect; | 97 | QAction* m_disconnect; |
98 | QAction* m_terminate; | 98 | QAction* m_terminate; |
99 | QAction* m_transfer; | 99 | QAction* m_transfer; |
100 | QAction* m_setProfiles; | 100 | QAction* m_setProfiles; |
101 | QAction* m_openKeys; | 101 | QAction* m_openKeys; |
102 | QAction* m_recordScript; | 102 | QAction* m_recordScript; |
103 | QAction* m_saveScript; | 103 | QAction* m_saveScript; |
104 | QAction* m_runScript; | 104 | QAction* m_runScript; |
105 | QAction* m_fullscreen; | ||
106 | QAction* m_closewindow; | ||
105 | 107 | ||
106 | FunctionKeyboard *m_kb; | 108 | FunctionKeyboard *m_kb; |
109 | bool m_isFullscreen; | ||
107 | }; | 110 | }; |
108 | 111 | ||
109 | 112 | ||
110 | #endif | 113 | #endif |