Commit 0e206c9f authored by Robert Knight's avatar Robert Knight
Browse files

Show terminal size on resize. Change default bell mode to 'System...

Show terminal size on resize.  Change default bell mode to 'System Notification' so that 'Configure Notifications' works.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=760957
parent 04a3fdfc
......@@ -273,7 +273,6 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_isFixedSize(false)
,_possibleTripleClick(false)
,_resizeWidget(0)
,_resizeLabel(0)
,_resizeTimer(0)
,_flowControlWarningEnabled(false)
,_outputSuspendedLabel(0)
......@@ -1014,46 +1013,36 @@ void TerminalDisplay::updateImage()
delete[] dirtyMask;
delete[] disstrU;
showResizeNotification();
}
void TerminalDisplay::showResizeNotification()
{
if (_resizing && _terminalSizeHint)
if (_terminalSizeHint)
{
if (_terminalSizeStartup) {
_terminalSizeStartup=false;
if (isVisible())
_terminalSizeStartup=false;
return;
}
if (!_resizeWidget)
{
_resizeWidget = new QFrame(this);
QFont f = KGlobalSettings::generalFont();
int fs = f.pointSize();
if (fs == -1)
fs = QFontInfo(f).pointSize();
f.setPointSize((fs*3)/2);
f.setBold(true);
_resizeWidget->setFont(f);
_resizeWidget->setFrameShape((QFrame::Shape) (QFrame::Box|QFrame::Raised));
_resizeWidget->setMidLineWidth(2);
QBoxLayout *l = new QVBoxLayout(_resizeWidget);
l->setMargin(10);
_resizeLabel = new QLabel(i18n("Size: XXX x XXX"), _resizeWidget);
l->addWidget(_resizeLabel, 1, Qt::AlignCenter);
_resizeWidget->setMinimumWidth(_resizeLabel->fontMetrics().width(i18n("Size: XXX x XXX"))+20);
_resizeWidget->setMinimumHeight(_resizeLabel->sizeHint().height()+20);
_resizeTimer = new QTimer(this);
_resizeTimer->setSingleShot(true);
_resizeWidget = new QLabel(i18n("Size: XXX x XXX"), this);
_resizeWidget->setMinimumWidth(_resizeWidget->fontMetrics().width(i18n("Size: XXX x XXX")));
_resizeWidget->setMinimumHeight(_resizeWidget->sizeHint().height());
_resizeWidget->setAlignment(Qt::AlignCenter);
_resizeWidget->setStyleSheet("background-color:palette(window);border-style:solid;border-width:1px;border-color:palette(dark)");
_resizeTimer = new QTimer(this);
_resizeTimer->setSingleShot(true);
connect(_resizeTimer, SIGNAL(timeout()), _resizeWidget, SLOT(hide()));
}
QString sizeStr = i18n("Size: %1 x %2", _columns, _lines);
_resizeLabel->setText(sizeStr);
_resizeWidget->setText(sizeStr);
_resizeWidget->move((width()-_resizeWidget->width())/2,
(height()-_resizeWidget->height())/2+20);
_resizeWidget->show();
_resizeTimer->start(3000);
_resizeTimer->start(1000);
}
}
......@@ -1427,6 +1416,7 @@ void TerminalDisplay::updateImageSize()
if ( _resizing )
{
showResizeNotification();
emit changedContentSizeSignal(_contentHeight, _contentWidth); // expose resizeEvent
}
......
......@@ -696,8 +696,7 @@ private:
// after QApplication::doubleClickInterval() delay
QFrame* _resizeWidget;
QLabel* _resizeLabel;
QLabel* _resizeWidget;
QTimer* _resizeTimer;
bool _flowControlWarningEnabled;
......
......@@ -609,10 +609,10 @@ TerminalDisplay* ViewManager::createTerminalDisplay(Session* session)
TerminalDisplay* display = new TerminalDisplay(0);
//TODO Temporary settings used here
display->setBellMode(0);
display->setTerminalSizeHint(false);
display->setBellMode(TerminalDisplay::NotifyBell);
display->setTerminalSizeHint(true);
display->setTripleClickMode(TerminalDisplay::SelectWholeLine);
display->setTerminalSizeStartup(false);
display->setTerminalSizeStartup(true);
display->setScrollBarPosition(TerminalDisplay::ScrollBarRight);
display->setRandomSeed(session->sessionId() * 31);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment