Allow views to be removed from a session. Better handling of terminal emulation size when a view is resized - Konsole looks through all of the visible views on a session and selects the largest number of lines and columns which can be displayed on all views.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=590854
wilder-portage
Robert Knight 20 years ago
parent df8aa4a68a
commit 7aca63ec00
  1. 3
      konsole/SessionManager.cpp
  2. 5
      konsole/SessionManager.h
  3. 7
      konsole/TEWidget.cpp
  4. 3
      konsole/TEmulation.cpp
  5. 8
      konsole/konsole.cpp
  6. 49
      konsole/session.cpp
  7. 2
      konsole/session.h

@ -187,6 +187,7 @@ SessionManager::~SessionManager()
void SessionManager::pushSessionSettings( const SessionInfo* info )
{
addSetting( InitialWorkingDirectory , SessionConfig , info->defaultWorkingDirectory() );
addSetting( ColorScheme , SessionConfig , info->colorScheme() );
}
TESession* SessionManager::createSession(QString configPath )
@ -208,7 +209,7 @@ TESession* SessionManager::createSession(QString configPath )
{
//supply settings from session config
pushSessionSettings( info );
//configuration information found, create a new session based on this
session = new TESession();

@ -138,7 +138,10 @@ public:
enum Setting
{
Font = 0,
InitialWorkingDirectory = 1
InitialWorkingDirectory = 1,
ColorScheme = 2,
HistoryEnabled = 3,
HistorySize = 4 // set to 0 for unlimited history ( stored in a file )
};
/** document me */

@ -1347,7 +1347,12 @@ void TEWidget::updateImageSize()
// `emu' will call back via `setImage'.
resizing = (oldlin!=lines) || (oldcol!=columns);
emit changedContentSizeSignal(contentHeight, contentWidth); // expose resizeEvent
if ( resizing )
{
emit changedContentSizeSignal(contentHeight, contentWidth); // expose resizeEvent
}
resizing = false;
}

@ -529,8 +529,9 @@ void TEmulation::addView(TEWidget* widget)
void TEmulation::removeView(TEWidget* widget)
{
Q_ASSERT(0); // Not implemented yet
_views.removeAll(widget);
disconnect(widget);
}
void TEmulation::showBulk()

@ -2783,6 +2783,7 @@ void Konsole::slotNewSessionAction(QAction* action)
// TODO: "type" isn't passed properly
Konsole* konsole = new Konsole(objectName().toLatin1(), b_histEnabled, !menubar->isHidden(), n_tabbar != TabNone, b_framevis,
n_scroll != TEWidget::SCRNONE, 0, false, 0);
konsole->setSessionManager( sessionManager() );
konsole->newSession();
konsole->enableFullScripting(b_fullScripting);
konsole->enableFixedSize(b_fixedSize);
@ -3629,10 +3630,15 @@ void Konsole::detachSession(TESession* _se) {
// TODO: "type" isn't passed properly
Konsole* konsole = new Konsole( objectName().toLatin1(), b_histEnabled, !menubar->isHidden(), n_tabbar != TabNone, b_framevis,
n_scroll != TEWidget::SCRNONE, 0, false, 0);
konsole->setSessionManager(sessionManager());
konsole->enableFullScripting(b_fullScripting);
// TODO; Make this work: konsole->enableFixedSize(b_fixedSize);
konsole->resize(size());
konsole->attachSession(_se);
_se->removeView( _se->primaryView() );
konsole->activateSession(_se);
konsole->changeTabTextColor( _se, se_tabtextcolor.rgb() );//restore prev color
konsole->slotTabSetViewOptions(m_tabViewMode);
@ -3680,7 +3686,7 @@ void Konsole::attachSession(TESession* session)
te->resize(se_widget->size());
te->setSize(se_widget->Columns(), se_widget->Lines());
initTEWidget(te, se_widget);
session->changeWidget(te);
session->addView(te);
te->setFocus();
createSessionTab(te, SmallIconSet(session->IconName()), session->Title());
setSchema(session->schemaNo() , te);

@ -218,19 +218,13 @@ void TESession::addView(TEWidget* widget)
if ( em != 0 )
em->addView(widget);
//temporary test
//if this is the first view then connect its resizing events
//to resizing of the emulation
if ( _views.count() == 1 )
{
font_h = primaryView()-> fontHeight();
font_w = primaryView()-> fontWidth();
QObject::connect(primaryView(),SIGNAL(changedContentSizeSignal(int,int)),
font_h = primaryView()-> fontHeight();
font_w = primaryView()-> fontWidth();
QObject::connect( widget ,SIGNAL(changedContentSizeSignal(int,int)),
this,SLOT(onContentSizeChange(int,int)));
QObject::connect(primaryView(),SIGNAL(changedFontMetricSignal(int,int)),
QObject::connect( widget ,SIGNAL(changedFontMetricSignal(int,int)),
this,SLOT(onFontMetricChange(int,int)));
}
}
void TESession::removeView(TEWidget* widget)
@ -523,9 +517,13 @@ void TESession::notifySessionState(int state)
void TESession::onContentSizeChange(int height, int width)
{
kDebug() << __FUNCTION__ << endl;
updateTerminalSize();
//kDebug(1211)<<"TESession::onContentSizeChange " << height << " " << width << endl;
em->onImageSizeChange( height/font_h, width/font_w );
sh->setSize( height/font_h, width/font_w );
// em->onImageSizeChange( height/font_h, width/font_w );
// sh->setSize( height/font_h, width/font_w );
}
void TESession::onFontMetricChange(int height, int width)
@ -537,6 +535,31 @@ void TESession::onFontMetricChange(int height, int width)
}
}
void TESession::updateTerminalSize()
{
QListIterator<TEWidget*> viewIter(_views);
int minLines = -1;
int minColumns = -1;
//select smallest number of lines and columns that will fit in all visible views
while ( viewIter.hasNext() )
{
TEWidget* view = viewIter.next();
if ( view->isHidden() == false )
{
minLines = (minLines == -1) ? view->Lines() : qMin( minLines , view->Lines() );
minColumns = (minColumns == -1) ? view->Columns() : qMin( minColumns , view->Columns() );
}
}
if ( minLines != -1 && minColumns != -1 )
{
em->onImageSizeChange( minLines , minColumns );
sh->setSize( minLines , minColumns );
}
}
bool TESession::sendSignal(int signal)
{
return sh->kill(signal);

@ -244,6 +244,8 @@ private Q_SLOTS:
private:
void updateTerminalSize();
TEPty* sh;
TEWidget* te;
TEmulation* em;

Loading…
Cancel
Save