author | mickeyl <mickeyl> | 2004-09-07 21:08:46 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-09-07 21:08:46 (UTC) |
commit | 9c92eb6569b2b3bcb1ad4a2edb2ad263ec9feaa4 (patch) (unidiff) | |
tree | 4a67a2a2129060582f8b9f020e19199d18d1c173 | |
parent | 16d38d11f57750551530017e92ba267fa55ebbac (diff) | |
download | opie-9c92eb6569b2b3bcb1ad4a2edb2ad263ec9feaa4.zip opie-9c92eb6569b2b3bcb1ad4a2edb2ad263ec9feaa4.tar.gz opie-9c92eb6569b2b3bcb1ad4a2edb2ad263ec9feaa4.tar.bz2 |
an attempt to fix #1393 - line wrap issues - at least for the default profile.
i can't see a connectio from the emulation handler back to the GUI so it's probably
still broken for non-default profiles
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 20 |
2 files changed, 7 insertions, 15 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index c8022b9..956ac76 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -1,48 +1,48 @@ | |||
1 | #include "TEmuVt102.h" | 1 | #include "TEmuVt102.h" |
2 | #include "profile.h" | 2 | #include "profile.h" |
3 | #include "emulation_handler.h" | 3 | #include "emulation_handler.h" |
4 | #include "script.h" | 4 | #include "script.h" |
5 | 5 | ||
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <opie2/odebug.h> | 7 | #include <opie2/odebug.h> |
8 | using namespace Opie::Core; | 8 | using namespace Opie::Core; |
9 | 9 | ||
10 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) | 10 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) |
11 | : QObject(0, name ) | 11 | : QObject(0, name ) |
12 | { | 12 | { |
13 | m_teWid = new TEWidget( parent, "TerminalMain"); | 13 | m_teWid = new TEWidget( parent, "TerminalMain"); |
14 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) | 14 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) |
15 | // use setWrapAt(80) for normal console with scrollbar | 15 | // use setWrapAt(80) for normal console with scrollbar |
16 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); | 16 | setWrap(prof.readNumEntry("Wrap", 80) ? 0 : 80); |
17 | m_teWid->setMinimumSize(150, 70 ); | 17 | m_teWid->setMinimumSize(150, 70 ); |
18 | m_script = 0; | 18 | m_script = 0; |
19 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 19 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
20 | m_teEmu = new TEmuVt102(m_teWid ); | 20 | m_teEmu = new TEmuVt102(m_teWid ); |
21 | 21 | ||
22 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), | 22 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), |
23 | this, SIGNAL(changeSize(int,int) ) ); | 23 | this, SIGNAL(changeSize(int,int) ) ); |
24 | connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), | 24 | connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), |
25 | this, SLOT(recvEmulation(const char*,int) ) ); | 25 | this, SLOT(recvEmulation(const char*,int) ) ); |
26 | m_teEmu->setConnect( true ); | 26 | m_teEmu->setConnect( true ); |
27 | m_teEmu->setHistory( TRUE ); | 27 | m_teEmu->setHistory( TRUE ); |
28 | load( prof ); | 28 | load( prof ); |
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | } | 32 | } |
33 | TEmulation* EmulationHandler::emulation() { | 33 | TEmulation* EmulationHandler::emulation() { |
34 | return m_teEmu; | 34 | return m_teEmu; |
35 | } | 35 | } |
36 | EmulationHandler::~EmulationHandler() { | 36 | EmulationHandler::~EmulationHandler() { |
37 | if (isRecording()) | 37 | if (isRecording()) |
38 | clearScript(); | 38 | clearScript(); |
39 | delete m_teEmu; | 39 | delete m_teEmu; |
40 | delete m_teWid; | 40 | delete m_teWid; |
41 | } | 41 | } |
42 | 42 | ||
43 | void EmulationHandler::load( const Profile& prof) { | 43 | void EmulationHandler::load( const Profile& prof) { |
44 | 44 | ||
45 | // m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | 45 | // m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); |
46 | QFont font( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal ); | 46 | QFont font( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal ); |
47 | font.setFixedPitch( TRUE ); | 47 | font.setFixedPitch( TRUE ); |
48 | m_teWid->setVTFont( font ); | 48 | m_teWid->setVTFont( font ); |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index b160604..15290ce 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -112,76 +112,77 @@ void MainWindow::initUI() { | |||
112 | this, SLOT(slotConnect() ) ); | 112 | this, SLOT(slotConnect() ) ); |
113 | 113 | ||
114 | /* | 114 | /* |
115 | * disconnect action | 115 | * disconnect action |
116 | */ | 116 | */ |
117 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), | 117 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), |
118 | QString::null, 0, this, 0 ); | 118 | QString::null, 0, this, 0 ); |
119 | m_disconnect->addTo( m_console ); | 119 | m_disconnect->addTo( m_console ); |
120 | connect(m_disconnect, SIGNAL(activated() ), | 120 | connect(m_disconnect, SIGNAL(activated() ), |
121 | this, SLOT(slotDisconnect() ) ); | 121 | this, SLOT(slotDisconnect() ) ); |
122 | 122 | ||
123 | m_console->insertSeparator(); | 123 | m_console->insertSeparator(); |
124 | 124 | ||
125 | 125 | ||
126 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); | 126 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); |
127 | m_quickLaunch->addTo( m_icons ); | 127 | m_quickLaunch->addTo( m_icons ); |
128 | connect( m_quickLaunch, SIGNAL( activated() ), | 128 | connect( m_quickLaunch, SIGNAL( activated() ), |
129 | this, SLOT( slotQuickLaunch() ) ); | 129 | this, SLOT( slotQuickLaunch() ) ); |
130 | 130 | ||
131 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); | 131 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); |
132 | 132 | ||
133 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 133 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
134 | 0, this, 0 ); | 134 | 0, this, 0 ); |
135 | m_transfer->addTo( m_console ); | 135 | m_transfer->addTo( m_console ); |
136 | connect(m_transfer, SIGNAL(activated() ), | 136 | connect(m_transfer, SIGNAL(activated() ), |
137 | this, SLOT(slotTransfer() ) ); | 137 | this, SLOT(slotTransfer() ) ); |
138 | 138 | ||
139 | 139 | ||
140 | 140 | ||
141 | /* | 141 | /* |
142 | * immediate change of line wrap policy | 142 | * immediate change of line wrap policy |
143 | */ | 143 | */ |
144 | m_isWrapped = false; | 144 | m_isWrapped = true; |
145 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); | 145 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0, true ); |
146 | m_wrap->addTo( m_console ); | 146 | m_wrap->addTo( m_console ); |
147 | m_wrap->setOn( true ); | ||
147 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 148 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
148 | 149 | ||
149 | /* | 150 | /* |
150 | * fullscreen | 151 | * fullscreen |
151 | */ | 152 | */ |
152 | m_isFullscreen = false; | 153 | m_isFullscreen = false; |
153 | 154 | ||
154 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 155 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
155 | , QString::null, 0, this, 0); | 156 | , QString::null, 0, this, 0, true ); |
156 | m_fullscreen->addTo( m_console ); | 157 | m_fullscreen->addTo( m_console ); |
157 | connect( m_fullscreen, SIGNAL( activated() ), | 158 | connect( m_fullscreen, SIGNAL( activated() ), |
158 | this, SLOT( slotFullscreen() ) ); | 159 | this, SLOT( slotFullscreen() ) ); |
159 | 160 | ||
160 | m_console->insertSeparator(); | 161 | m_console->insertSeparator(); |
161 | 162 | ||
162 | QAction *a = new QAction(); | 163 | QAction *a = new QAction(); |
163 | a->setText( tr("Save history") ); | 164 | a->setText( tr("Save history") ); |
164 | a->addTo( m_console ); | 165 | a->addTo( m_console ); |
165 | connect(a, SIGNAL(activated() ), | 166 | connect(a, SIGNAL(activated() ), |
166 | this, SLOT(slotSaveHistory() ) ); | 167 | this, SLOT(slotSaveHistory() ) ); |
167 | /* | 168 | /* |
168 | * terminate action | 169 | * terminate action |
169 | */ | 170 | */ |
170 | m_terminate = new QAction(); | 171 | m_terminate = new QAction(); |
171 | m_terminate->setText( tr("Terminate") ); | 172 | m_terminate->setText( tr("Terminate") ); |
172 | m_terminate->addTo( m_console ); | 173 | m_terminate->addTo( m_console ); |
173 | connect(m_terminate, SIGNAL(activated() ), | 174 | connect(m_terminate, SIGNAL(activated() ), |
174 | this, SLOT(slotTerminate() ) ); | 175 | this, SLOT(slotTerminate() ) ); |
175 | 176 | ||
176 | m_closewindow = new QAction(); | 177 | m_closewindow = new QAction(); |
177 | m_closewindow->setText( tr("Close Window") ); | 178 | m_closewindow->setText( tr("Close Window") ); |
178 | m_closewindow->addTo( m_console ); | 179 | m_closewindow->addTo( m_console ); |
179 | connect( m_closewindow, SIGNAL(activated() ), | 180 | connect( m_closewindow, SIGNAL(activated() ), |
180 | this, SLOT(slotClose() ) ); | 181 | this, SLOT(slotClose() ) ); |
181 | 182 | ||
182 | 183 | ||
183 | /* | 184 | /* |
184 | * script actions | 185 | * script actions |
185 | */ | 186 | */ |
186 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); | 187 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); |
187 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); | 188 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); |
@@ -505,65 +506,64 @@ void MainWindow::create( const Profile& prof ) { | |||
505 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 506 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
506 | { | 507 | { |
507 | QMessageBox::warning(this, | 508 | QMessageBox::warning(this, |
508 | QObject::tr("Session failed"), | 509 | QObject::tr("Session failed"), |
509 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 510 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
510 | //if(ses) delete ses; | 511 | //if(ses) delete ses; |
511 | return; | 512 | return; |
512 | } | 513 | } |
513 | 514 | ||
514 | m_sessions.append( ses ); | 515 | m_sessions.append( ses ); |
515 | tabWidget()->add( ses ); | 516 | tabWidget()->add( ses ); |
516 | tabWidget()->repaint(); | 517 | tabWidget()->repaint(); |
517 | m_curSession = ses; | 518 | m_curSession = ses; |
518 | 519 | ||
519 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 520 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
520 | m_connect->setEnabled( true ); | 521 | m_connect->setEnabled( true ); |
521 | m_disconnect->setEnabled( false ); | 522 | m_disconnect->setEnabled( false ); |
522 | m_terminate->setEnabled( true ); | 523 | m_terminate->setEnabled( true ); |
523 | m_fullscreen->setEnabled( true ); | 524 | m_fullscreen->setEnabled( true ); |
524 | m_wrap->setEnabled( true ); | 525 | m_wrap->setEnabled( true ); |
525 | m_closewindow->setEnabled( true ); | 526 | m_closewindow->setEnabled( true ); |
526 | m_transfer->setEnabled( false ); | 527 | m_transfer->setEnabled( false ); |
527 | m_recordScript->setEnabled( false ); | 528 | m_recordScript->setEnabled( false ); |
528 | m_saveScript->setEnabled( false ); | 529 | m_saveScript->setEnabled( false ); |
529 | m_scripts->setItemEnabled(m_runScript_id, false); | 530 | m_scripts->setItemEnabled(m_runScript_id, false); |
530 | 531 | ||
531 | // is io_layer wants direct connection, then autoconnect | 532 | // is io_layer wants direct connection, then autoconnect |
532 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 533 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
533 | if (prof.autoConnect()) { | 534 | if (prof.autoConnect()) { |
534 | slotConnect(); | 535 | slotConnect(); |
535 | } | 536 | } |
536 | 537 | ||
537 | |||
538 | QWidget *w = currentSession()->widget(); | 538 | QWidget *w = currentSession()->widget(); |
539 | if(w) w->setFocus(); | 539 | if(w) w->setFocus(); |
540 | 540 | ||
541 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 541 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
542 | m_isWrapped = true; | 542 | m_isWrapped = true; |
543 | } else { | 543 | } else { |
544 | m_isWrapped = false; | 544 | m_isWrapped = false; |
545 | } | 545 | } |
546 | 546 | ||
547 | m_kb->load(currentSession()->profile()); | 547 | m_kb->load(currentSession()->profile()); |
548 | } | 548 | } |
549 | 549 | ||
550 | void MainWindow::slotTransfer() | 550 | void MainWindow::slotTransfer() |
551 | { | 551 | { |
552 | if ( currentSession() ) { | 552 | if ( currentSession() ) { |
553 | Session *mysession = currentSession(); | 553 | Session *mysession = currentSession(); |
554 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); | 554 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); |
555 | mysession->setTransferDialog(&dlg); | 555 | mysession->setTransferDialog(&dlg); |
556 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); | 556 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); |
557 | //dlg.showMaximized(); | 557 | //dlg.showMaximized(); |
558 | currentSession()->widgetStack()->addWidget(&dlg, -1); | 558 | currentSession()->widgetStack()->addWidget(&dlg, -1); |
559 | dlg.show(); | 559 | dlg.show(); |
560 | //dlg.exec(); | 560 | //dlg.exec(); |
561 | while(dlg.isRunning()) qApp->processEvents(); | 561 | while(dlg.isRunning()) qApp->processEvents(); |
562 | mysession->setTransferDialog(0l); | 562 | mysession->setTransferDialog(0l); |
563 | } | 563 | } |
564 | } | 564 | } |
565 | 565 | ||
566 | 566 | ||
567 | void MainWindow::slotOpenKeb(bool state) { | 567 | void MainWindow::slotOpenKeb(bool state) { |
568 | 568 | ||
569 | if (state) m_keyBar->show(); | 569 | if (state) m_keyBar->show(); |
@@ -605,74 +605,66 @@ void MainWindow::slotSessionChanged( Session* ses ) { | |||
605 | m_disconnect->setEnabled( false ); | 605 | m_disconnect->setEnabled( false ); |
606 | m_recordScript->setEnabled( false ); | 606 | m_recordScript->setEnabled( false ); |
607 | m_saveScript->setEnabled( false ); | 607 | m_saveScript->setEnabled( false ); |
608 | m_scripts->setItemEnabled(m_runScript_id, false); | 608 | m_scripts->setItemEnabled(m_runScript_id, false); |
609 | } | 609 | } |
610 | 610 | ||
611 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 611 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
612 | m_transfer->setEnabled( false ); | 612 | m_transfer->setEnabled( false ); |
613 | } else { | 613 | } else { |
614 | m_transfer->setEnabled( true ); | 614 | m_transfer->setEnabled( true ); |
615 | } | 615 | } |
616 | 616 | ||
617 | QWidget *w = m_curSession->widget(); | 617 | QWidget *w = m_curSession->widget(); |
618 | if(w) w->setFocus(); | 618 | if(w) w->setFocus(); |
619 | 619 | ||
620 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 620 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
621 | m_isWrapped = true; | 621 | m_isWrapped = true; |
622 | } else { | 622 | } else { |
623 | m_isWrapped = false; | 623 | m_isWrapped = false; |
624 | } | 624 | } |
625 | 625 | ||
626 | m_kb->load(currentSession()->profile()); | 626 | m_kb->load(currentSession()->profile()); |
627 | } | 627 | } |
628 | } | 628 | } |
629 | 629 | ||
630 | void MainWindow::slotWrap() | 630 | void MainWindow::slotWrap() |
631 | { | 631 | { |
632 | if(m_curSession) | 632 | if(m_curSession) |
633 | { | 633 | { |
634 | EmulationHandler *e = m_curSession->emulationHandler(); | 634 | EmulationHandler *e = m_curSession->emulationHandler(); |
635 | if(e) | 635 | if(e) |
636 | { | 636 | { |
637 | if(m_isWrapped) | 637 | e->setWrap( m_isWrapped ? 80:0 ); |
638 | { | 638 | m_isWrapped = !m_isWrapped; |
639 | e->setWrap(80); | ||
640 | m_isWrapped = false; | ||
641 | } | ||
642 | else | ||
643 | { | ||
644 | e->setWrap(0); | ||
645 | m_isWrapped = true; | ||
646 | } | ||
647 | } | 639 | } |
648 | } | 640 | } |
649 | } | 641 | } |
650 | 642 | ||
651 | void MainWindow::slotFullscreen() { | 643 | void MainWindow::slotFullscreen() { |
652 | 644 | ||
653 | 645 | ||
654 | 646 | ||
655 | if ( m_isFullscreen ) { | 647 | if ( m_isFullscreen ) { |
656 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 648 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
657 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 649 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
658 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 650 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
659 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 651 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
660 | 652 | ||
661 | } else { | 653 | } else { |
662 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); | 654 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); |
663 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 655 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
664 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 656 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
665 | , QPoint(0,0), false ); | 657 | , QPoint(0,0), false ); |
666 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 658 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
667 | ( m_curSession->widgetStack() )->setFocus(); | 659 | ( m_curSession->widgetStack() )->setFocus(); |
668 | ( m_curSession->widgetStack() )->show(); | 660 | ( m_curSession->widgetStack() )->show(); |
669 | 661 | ||
670 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 662 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
671 | 663 | ||
672 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 664 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
673 | } | 665 | } |
674 | 666 | ||
675 | m_isFullscreen = !m_isFullscreen; | 667 | m_isFullscreen = !m_isFullscreen; |
676 | } | 668 | } |
677 | 669 | ||
678 | 670 | ||