summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-21 22:29:00 (UTC)
committer harlekin <harlekin>2003-03-21 22:29:00 (UTC)
commit43b0fded770624c907aae043e88449f80040d7df (patch) (unidiff)
tree37e92b5da66c34323a831586c21a9c23b0abe261
parent07a03b603d964b07d2866e04f480014fadcf1570 (diff)
downloadopie-43b0fded770624c907aae043e88449f80040d7df.zip
opie-43b0fded770624c907aae043e88449f80040d7df.tar.gz
opie-43b0fded770624c907aae043e88449f80040d7df.tar.bz2
added a button for quicklaunch of a default profile
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp21
-rw-r--r--noncore/apps/opie-console/mainwindow.h2
-rw-r--r--noncore/apps/opie-console/terminalwidget.cpp26
-rw-r--r--pics/console/konsole_mini.pngbin0 -> 783 bytes
4 files changed, 36 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index abcdb84..a6fc30b 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -39,32 +39,33 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(
39 for (int i = 0; i < KeyTrans::count(); i++ ) { 39 for (int i = 0; i < KeyTrans::count(); i++ ) {
40 KeyTrans* s = KeyTrans::find(i ); 40 KeyTrans* s = KeyTrans::find(i );
41 assert( s ); 41 assert( s );
42 } 42 }
43 m_factory = new MetaFactory(); 43 m_factory = new MetaFactory();
44 Default def(m_factory); 44 Default def(m_factory);
45 m_sessions.setAutoDelete( TRUE ); 45 m_sessions.setAutoDelete( TRUE );
46 m_curSession = 0; 46 m_curSession = 0;
47 m_manager = new ProfileManager( m_factory ); 47 m_manager = new ProfileManager( m_factory );
48 m_manager->load(); 48 m_manager->load();
49 m_scriptsData.setAutoDelete(TRUE); 49 m_scriptsData.setAutoDelete(TRUE);
50 50
51 initUI(); 51 initUI();
52 populateProfiles(); 52 populateProfiles();
53 populateScripts(); 53 populateScripts();
54} 54}
55
55void MainWindow::initUI() { 56void MainWindow::initUI() {
56 setToolBarsMovable( FALSE ); 57 setToolBarsMovable( FALSE );
57 58
58 /* tool bar for the menu */ 59 /* tool bar for the menu */
59 m_tool = new QToolBar( this ); 60 m_tool = new QToolBar( this );
60 m_tool->setHorizontalStretchable( TRUE ); 61 m_tool->setHorizontalStretchable( TRUE );
61 62
62 m_bar = new QMenuBar( m_tool ); 63 m_bar = new QMenuBar( m_tool );
63 m_console = new QPopupMenu( this ); 64 m_console = new QPopupMenu( this );
64 m_scripts = new QPopupMenu( this ); 65 m_scripts = new QPopupMenu( this );
65 m_sessionsPop= new QPopupMenu( this ); 66 m_sessionsPop= new QPopupMenu( this );
66 m_scriptsPop = new QPopupMenu( this ); 67 m_scriptsPop = new QPopupMenu( this );
67 68
68 /* add a toolbar for icons */ 69 /* add a toolbar for icons */
69 m_icons = new QToolBar(this); 70 m_icons = new QToolBar(this);
70 71
@@ -106,38 +107,45 @@ void MainWindow::initUI() {
106 QString::null, 0, this, 0 ); 107 QString::null, 0, this, 0 );
107 m_connect->addTo( m_console ); 108 m_connect->addTo( m_console );
108 connect(m_connect, SIGNAL(activated() ), 109 connect(m_connect, SIGNAL(activated() ),
109 this, SLOT(slotConnect() ) ); 110 this, SLOT(slotConnect() ) );
110 111
111 /* 112 /*
112 * disconnect action 113 * disconnect action
113 */ 114 */
114 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), 115 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"),
115 QString::null, 0, this, 0 ); 116 QString::null, 0, this, 0 );
116 m_disconnect->addTo( m_console ); 117 m_disconnect->addTo( m_console );
117 connect(m_disconnect, SIGNAL(activated() ), 118 connect(m_disconnect, SIGNAL(activated() ),
118 this, SLOT(slotDisconnect() ) ); 119 this, SLOT(slotDisconnect() ) );
119 120
120 m_console->insertSeparator(); 121 m_console->insertSeparator();
121 122
123 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 );
124 m_quickLaunch->addTo( m_icons );
125 connect( m_quickLaunch, SIGNAL( activated() ),
126 this, SLOT( slotQuickLaunch() ) );
127
122 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, 128 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null,
123 0, this, 0 ); 129 0, this, 0 );
124 m_transfer->addTo( m_console ); 130 m_transfer->addTo( m_console );
125 connect(m_transfer, SIGNAL(activated() ), 131 connect(m_transfer, SIGNAL(activated() ),
126 this, SLOT(slotTransfer() ) ); 132 this, SLOT(slotTransfer() ) );
127 133
134
135
128 /* 136 /*
129 * immediate change of line wrap policy 137 * immediate change of line wrap policy
130 */ 138 */
131 m_isWrapped = false; 139 m_isWrapped = false;
132 m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); 140 m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 );
133 m_wrap->addTo( m_console ); 141 m_wrap->addTo( m_console );
134 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); 142 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
135 143
136 /* 144 /*
137 * fullscreen 145 * fullscreen
138 */ 146 */
139 m_isFullscreen = false; 147 m_isFullscreen = false;
140 148
141 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 149 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
142 , QString::null, 0, this, 0); 150 , QString::null, 0, this, 0);
143 m_fullscreen->addTo( m_console ); 151 m_fullscreen->addTo( m_console );
@@ -389,32 +397,42 @@ void MainWindow::slotDisconnect() {
389 m_disconnect->setEnabled( false ); 397 m_disconnect->setEnabled( false );
390 m_transfer->setEnabled( false ); 398 m_transfer->setEnabled( false );
391 m_recordScript->setEnabled( false); 399 m_recordScript->setEnabled( false);
392 m_saveScript->setEnabled( false ); 400 m_saveScript->setEnabled( false );
393 m_scripts->setItemEnabled(m_runScript_id, false); 401 m_scripts->setItemEnabled(m_runScript_id, false);
394 } 402 }
395} 403}
396 404
397void MainWindow::slotTerminate() { 405void MainWindow::slotTerminate() {
398 if ( currentSession() ) 406 if ( currentSession() )
399 currentSession()->layer()->close(); 407 currentSession()->layer()->close();
400 408
401 slotClose(); 409 slotClose();
402 /* FIXME move to the next session */ 410 /* FIXME move to the next session */
403} 411}
404 412
413void MainWindow::slotQuickLaunch() {
414 Profile prof = manager()->profile( "default" );
415 if ( prof.name() == "default" ) {
416 create( prof );
417 } else {
418 QMessageBox::warning(this, tr("Failure"),tr("please configure one profile named \"default\""));
419 }
420
421}
422
405void MainWindow::slotConfigure() { 423void MainWindow::slotConfigure() {
406 ConfigDialog conf( manager()->all(), factory() ); 424 ConfigDialog conf( manager()->all(), factory() );
407 conf.showMaximized(); 425 conf.showMaximized();
408 426
409 int ret = conf.exec(); 427 int ret = conf.exec();
410 428
411 if ( QDialog::Accepted == ret ) { 429 if ( QDialog::Accepted == ret ) {
412 manager()->setProfiles( conf.list() ); 430 manager()->setProfiles( conf.list() );
413 manager()->save(); 431 manager()->save();
414 populateProfiles(); 432 populateProfiles();
415 } 433 }
416} 434}
417/* 435/*
418 * we will remove 436 * we will remove
419 * this window from the tabwidget 437 * this window from the tabwidget
420 * remove it from the list 438 * remove it from the list
@@ -446,32 +464,35 @@ void MainWindow::slotClose() {
446 m_wrap->setEnabled( false ); 464 m_wrap->setEnabled( false );
447 m_closewindow->setEnabled( false ); 465 m_closewindow->setEnabled( false );
448 } 466 }
449 467
450 m_kb->loadDefaults(); 468 m_kb->loadDefaults();
451} 469}
452 470
453/* 471/*
454 * We will get the name 472 * We will get the name
455 * Then the profile 473 * Then the profile
456 * and then we will make a profile 474 * and then we will make a profile
457 */ 475 */
458void MainWindow::slotProfile( int id) { 476void MainWindow::slotProfile( int id) {
459 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 477 Profile prof = manager()->profile( m_sessionsPop->text( id) );
460 create( prof ); 478 create( prof );
461} 479}
480
481
482
462void MainWindow::create( const Profile& prof ) { 483void MainWindow::create( const Profile& prof ) {
463 if(m_curSession) 484 if(m_curSession)
464 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 485 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
465 486
466 Session *ses = manager()->fromProfile( prof, tabWidget() ); 487 Session *ses = manager()->fromProfile( prof, tabWidget() );
467 488
468 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 489 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
469 { 490 {
470 QMessageBox::warning(this, 491 QMessageBox::warning(this,
471 QObject::tr("Session failed"), 492 QObject::tr("Session failed"),
472 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 493 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
473 //if(ses) delete ses; 494 //if(ses) delete ses;
474 return; 495 return;
475 } 496 }
476 497
477 m_sessions.append( ses ); 498 m_sessions.append( ses );
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 0fac38b..86939c1 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -54,32 +54,33 @@ public:
54 54
55private slots: 55private 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(int); 68 void slotRunScript(int);
69 void slotFullscreen(); 69 void slotFullscreen();
70 void slotQuickLaunch();
70 void slotWrap(); 71 void slotWrap();
71 void slotSessionChanged( Session* ); 72 void slotSessionChanged( Session* );
72 void slotKeyReceived(FKey, ushort, ushort, bool); 73 void slotKeyReceived(FKey, ushort, ushort, bool);
73 void slotSaveHistory(); 74 void slotSaveHistory();
74 75
75 /* what could these both slot do? */ 76 /* what could these both slot do? */
76 void slotCopy(); 77 void slotCopy();
77 void slotPaste(); 78 void slotPaste();
78 79
79 /* save the currentSession() to Profiles */ 80 /* save the currentSession() to Profiles */
80 void slotSaveSession(); 81 void slotSaveSession();
81 82
82private: 83private:
83 void initUI(); 84 void initUI();
84 void populateProfiles(); 85 void populateProfiles();
85 void populateScripts(); 86 void populateScripts();
@@ -100,32 +101,33 @@ private:
100 */ 101 */
101 MetaFactory* m_factory; 102 MetaFactory* m_factory;
102 ProfileManager* m_manager; 103 ProfileManager* m_manager;
103 104
104 TabWidget* m_consoleWindow; 105 TabWidget* m_consoleWindow;
105 QToolBar* m_tool; 106 QToolBar* m_tool;
106 QToolBar* m_icons; 107 QToolBar* m_icons;
107 QToolBar* m_keyBar; 108 QToolBar* m_keyBar;
108 QToolBar* m_buttonBar; 109 QToolBar* m_buttonBar;
109 QMenuBar* m_bar; 110 QMenuBar* m_bar;
110 QPopupMenu* m_console; 111 QPopupMenu* m_console;
111 QPopupMenu* m_sessionsPop; 112 QPopupMenu* m_sessionsPop;
112 QPopupMenu* m_scriptsPop; 113 QPopupMenu* m_scriptsPop;
113 QPopupMenu* m_scripts; 114 QPopupMenu* m_scripts;
114 QAction* m_connect; 115 QAction* m_connect;
115 QAction* m_disconnect; 116 QAction* m_disconnect;
117 QAction* m_quickLaunch;
116 QAction* m_terminate; 118 QAction* m_terminate;
117 QAction* m_transfer; 119 QAction* m_transfer;
118 QAction* m_setProfiles; 120 QAction* m_setProfiles;
119 QAction* m_openKeys; 121 QAction* m_openKeys;
120 QAction* m_openButtons; 122 QAction* m_openButtons;
121 QAction* m_recordScript; 123 QAction* m_recordScript;
122 QAction* m_saveScript; 124 QAction* m_saveScript;
123 QAction* m_fullscreen; 125 QAction* m_fullscreen;
124 QAction* m_wrap; 126 QAction* m_wrap;
125 QAction* m_closewindow; 127 QAction* m_closewindow;
126 128
127 FunctionKeyboard *m_kb; 129 FunctionKeyboard *m_kb;
128 int m_runScript_id; 130 int m_runScript_id;
129 bool m_isFullscreen; 131 bool m_isFullscreen;
130 bool m_isWrapped; 132 bool m_isWrapped;
131 133
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp
index a8cee93..70f7c9b 100644
--- a/noncore/apps/opie-console/terminalwidget.cpp
+++ b/noncore/apps/opie-console/terminalwidget.cpp
@@ -35,54 +35,54 @@ namespace {
35}; 35};
36 36
37TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, 37TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
38 const char* na ) 38 const char* na )
39 : ProfileDialogTerminalWidget( name, parent, na ) { 39 : ProfileDialogTerminalWidget( name, parent, na ) {
40 40
41 m_terminal = new QLabel(tr("Terminal Type"), this ); 41 m_terminal = new QLabel(tr("Terminal Type"), this );
42 m_terminalBox = new QComboBox(this); 42 m_terminalBox = new QComboBox(this);
43 m_colorLabel = new QLabel(tr("Color scheme"), this); 43 m_colorLabel = new QLabel(tr("Color scheme"), this);
44 m_colorCmb = new QComboBox(this ); 44 m_colorCmb = new QComboBox(this );
45 45
46 m_groupSize = new QHButtonGroup(tr("Font size"), this ); 46 m_groupSize = new QHButtonGroup(tr("Font size"), this );
47 m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); 47 m_sizeSmall = new QRadioButton(tr("small"), m_groupSize );
48 m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); 48 m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize );
49 m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); 49 m_sizeLarge = new QRadioButton(tr("large"), m_groupSize );
50 50
51 m_groupConv = new QHGroupBox(tr("Line-break conversions"), this ); 51 m_groupConv = new QHGroupBox( tr("Line-break conversions"), this );
52 m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv ); 52 m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv );
53 m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv ); 53 m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv );
54 54
55 m_groupOptions = new QHGroupBox( tr("Options"), this ); 55 m_groupOptions = new QHGroupBox( tr("Options"), this );
56 m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions ); 56 m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions );
57 m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); 57 m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions );
58 58
59 m_lroot = new QVBoxLayout( this ); 59 m_lroot = new QVBoxLayout( this );
60 m_typeBox = new QVBoxLayout( m_lroot ); 60 m_typeBox = new QVBoxLayout( m_lroot );
61 m_colorBox = new QVBoxLayout( m_lroot ); 61 m_colorBox = new QVBoxLayout( m_lroot );
62 62
63 // Layout 63 // Layout
64 m_typeBox->add(m_terminal ); 64 m_typeBox->add( m_terminal );
65 m_typeBox->add(m_terminalBox ); 65 m_typeBox->add( m_terminalBox );
66 m_lroot->add(m_groupSize ); 66 m_lroot->add( m_groupSize );
67 67
68 m_colorBox->add( m_colorLabel ); 68 m_colorBox->add( m_colorLabel );
69 m_colorBox->add( m_colorCmb ); 69 m_colorBox->add( m_colorCmb );
70 70
71 m_lroot->add(m_groupConv ); 71 m_lroot->add( m_groupConv );
72 m_lroot->add(m_groupOptions ); 72 m_lroot->add( m_groupOptions );
73 m_lroot->addStretch( 0 ); 73 m_lroot->addStretch( 0 );
74 74
75 // Fill in some options 75 // Fill in some options
76 qWarning("Options for terminal box"); 76 qWarning("Options for terminal box");
77 m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); 77 m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ );
78 m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); 78 m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */);
79 m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); 79 m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux );
80 m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); 80 m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm );
81 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); 81 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi );
82 82
83 m_colorCmb->insertItem( tr("black on white"), id_term_black ); 83 m_colorCmb->insertItem( tr("black on white"), id_term_black );
84 m_colorCmb->insertItem( tr("white on black"), id_term_white ); 84 m_colorCmb->insertItem( tr("white on black"), id_term_white );
85 m_colorCmb->insertItem( tr("green on black"), id_term_green ); 85 m_colorCmb->insertItem( tr("green on black"), id_term_green );
86 m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); 86 m_colorCmb->insertItem( tr("orange on black"), id_term_orange );
87 87
88 // signals + slots 88 // signals + slots
diff --git a/pics/console/konsole_mini.png b/pics/console/konsole_mini.png
new file mode 100644
index 0000000..590a417
--- a/dev/null
+++ b/pics/console/konsole_mini.png
Binary files differ