Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 9ea9d627 authored by Jekyll Wu's avatar Jekyll Wu

Reimplement the feature of "show/hide the size widget after resising"

This is a follow up of commit b40a006d which closees BUG 169054.
It turns out the old code already has most parts of similar logic.
So remove duplicated logic in the code.
parent 3a1f804f
......@@ -287,7 +287,7 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
// window options
_ui->showMenuBarButton->setChecked( info->property<bool>(Profile::ShowMenuBar) );
_ui->showSizeWidgetButton->setChecked( info->property<bool>(Profile::ShowSizeWidget) );
_ui->showTerminalSizeHintButton->setChecked( info->property<bool>(Profile::ShowTerminalSizeHint) );
_ui->saveGeometryOnExitButton->setChecked( info->property<bool>(Profile::SaveGeometryOnExit) );
// signals and slots
......@@ -308,8 +308,8 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
SLOT(showMenuBar(bool)) );
connect(_ui->saveGeometryOnExitButton , SIGNAL(toggled(bool)) , this ,
SLOT(saveGeometryOnExit(bool)) );
connect(_ui->showSizeWidgetButton , SIGNAL(toggled(bool)) , this ,
SLOT(showSizeWidget(bool)) );
connect(_ui->showTerminalSizeHintButton , SIGNAL(toggled(bool)) , this ,
SLOT(showTerminalSizeHint(bool)) );
}
void EditProfileDialog::showEnvironmentEditor()
{
......@@ -429,9 +429,9 @@ void EditProfileDialog::saveGeometryOnExit(bool save)
{
updateTempProfileProperty(Profile::SaveGeometryOnExit,save);
}
void EditProfileDialog::showSizeWidget(bool show)
void EditProfileDialog::showTerminalSizeHint(bool show)
{
updateTempProfileProperty(Profile::ShowSizeWidget,show);
updateTempProfileProperty(Profile::ShowTerminalSizeHint,show);
}
void EditProfileDialog::tabTitleFormatChanged(const QString& format)
{
......
......@@ -118,7 +118,7 @@ private slots:
void insertRemoteTabTitleText(const QString& text);
void showMenuBar(bool);
void showSizeWidget(bool);
void showTerminalSizeHint(bool);
void saveGeometryOnExit(bool);
void showEnvironmentEditor();
void tabBarVisibilityChanged(int);
......
......@@ -242,12 +242,12 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="showSizeWidgetButton" >
<widget class="QCheckBox" name="showTerminalSizeHintButton" >
<property name="toolTip" >
<string>Show new size of the terminal after resizing</string>
<string>Show terminal size in columns and lines in the center of window after resizing</string>
</property>
<property name="text" >
<string>Show terminal size after resizing</string>
<string>Show hint for terminal size after resizing</string>
</property>
</widget>
</item>
......
......@@ -76,7 +76,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] =
, { LocalTabTitleFormat , "tabtitle" , 0 , QVariant::String }
, { RemoteTabTitleFormat , "RemoteTabTitleFormat" , GENERAL_GROUP , QVariant::String }
, { ShowMenuBar , "ShowMenuBar" , GENERAL_GROUP , QVariant::Bool }
, { ShowSizeWidget , "ShowSizeWidget" , GENERAL_GROUP , QVariant::Bool }
, { ShowTerminalSizeHint , "ShowTerminalSizeHint" , GENERAL_GROUP , QVariant::Bool }
, { SaveGeometryOnExit , "SaveGeometryOnExit" , GENERAL_GROUP , QVariant::Bool }
, { TabBarMode , "TabBarMode" , GENERAL_GROUP , QVariant::Int }
, { TabBarPosition , "TabBarPosition" , GENERAL_GROUP , QVariant::Int }
......@@ -161,7 +161,7 @@ FallbackProfile::FallbackProfile()
setProperty(TabBarPosition,TabBarBottom);
setProperty(NewTabBehavior,PutNewTabAtTheEnd);
setProperty(ShowMenuBar,true);
setProperty(ShowSizeWidget,true);
setProperty(ShowTerminalSizeHint,true);
setProperty(SaveGeometryOnExit,true);
setProperty(StartInCurrentSessionDir,true);
setProperty(ShowNewAndCloseTabButtons,false);
......
......@@ -113,8 +113,8 @@ public:
RemoteTabTitleFormat,
/** (bool) Specifies whether the menu bar should be shown in the main application window. */
ShowMenuBar,
/** (bool) Specifies whether show size information after resizing the application window. */
ShowSizeWidget,
/** (bool) Specifies whether show hint for terminal size after resizing the application window. */
ShowTerminalSizeHint,
/** (bool) Specifies whether the geometry information is saved when window is closed. */
SaveGeometryOnExit,
/** (TabBarModeEnum) Specifies when the tab bar should be shown in
......
......@@ -297,7 +297,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_image(0)
,_randomSeed(0)
,_resizing(false)
,_terminalSizeHint(false)
,_showTerminalSizeHint(false)
,_terminalSizeStartup(true)
,_bidiEnabled(false)
,_actSel(0)
......@@ -318,7 +318,6 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_ctrlDrag(true)
,_tripleClickMode(SelectWholeLine)
,_possibleTripleClick(false)
,_showSizeWidget(true)
,_resizeWidget(0)
,_resizeTimer(0)
,_flowControlWarningEnabled(false)
......@@ -1105,7 +1104,7 @@ void TerminalDisplay::updateImage()
void TerminalDisplay::showResizeNotification()
{
if (_terminalSizeHint && isVisible())
if (_showTerminalSizeHint && isVisible())
{
if (_terminalSizeStartup) {
_terminalSizeStartup=false;
......@@ -1620,9 +1619,8 @@ void TerminalDisplay::updateImageSize()
if ( _resizing )
{
if (_showSizeWidget)
showResizeNotification();
emit changedContentSizeSignal(_contentHeight, _contentWidth); // expose resizeEvent
emit changedContentSizeSignal(_contentHeight, _contentWidth); // expose resizeEvent
}
_resizing = false;
......@@ -2411,11 +2409,6 @@ void TerminalDisplay::mouseTripleClickEvent(QMouseEvent* ev)
}
void Konsole::TerminalDisplay::setSizeWidgetVisibility(bool visible)
{
_showSizeWidget = visible;
}
bool TerminalDisplay::focusNextPrevChild( bool next )
{
if (next)
......
......@@ -121,10 +121,6 @@ public:
*/
void setScroll(int cursor, int lines);
/**
* Sets if the size widget is going to be shown or not
*/
void setSizeWidgetVisibility(bool visible);
/**
* Returns the display's filter chain. When the image for the display is updated,
* the text is passed through each filter in the chain. Each filter can define
......@@ -392,18 +388,18 @@ public:
* terminal in lines and columns is displayed whilst the widget
* is being resized.
*/
void setTerminalSizeHint(bool on) { _terminalSizeHint=on; }
void setShowTerminalSizeHint(bool on) { _showTerminalSizeHint=on; }
/**
* Returns whether or not the current height and width of
* the terminal in lines and columns is displayed whilst the widget
* is being resized.
*/
bool terminalSizeHint() { return _terminalSizeHint; }
bool showTerminalSizeHint() { return _showTerminalSizeHint; }
/**
* Sets whether the terminal size display is shown briefly
* after the widget is first shown.
*
* See setTerminalSizeHint() , isTerminalSizeHint()
* See setShowTerminalSizeHint() , isTerminalSizeHint()
*/
void setTerminalSizeStartup(bool on) { _terminalSizeStartup=on; }
......@@ -746,7 +742,7 @@ private:
uint _randomSeed;
bool _resizing;
bool _terminalSizeHint;
bool _showTerminalSizeHint;
bool _terminalSizeStartup;
bool _bidiEnabled;
bool _mouseMarks;
......@@ -787,7 +783,6 @@ private:
bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
// after QApplication::doubleClickInterval() delay
bool _showSizeWidget; // if the size widget will be show
QLabel* _resizeWidget;
QTimer* _resizeTimer;
......
......@@ -802,7 +802,7 @@ TerminalDisplay* ViewManager::createTerminalDisplay(Session* session)
//TODO Temporary settings used here
display->setBellMode(TerminalDisplay::NotifyBell);
display->setTerminalSizeHint(true);
display->setShowTerminalSizeHint(true);
display->setTripleClickMode(TerminalDisplay::SelectWholeLine);
display->setTerminalSizeStartup(true);
display->setScrollBarPosition(TerminalDisplay::ScrollBarRight);
......@@ -858,8 +858,8 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
else if ( scrollBarPosition == Profile::ScrollBarRight )
view->setScrollBarPosition(TerminalDisplay::ScrollBarRight);
// set visibility of the size widget
view->setSizeWidgetVisibility(info->property<bool>(Profile::ShowSizeWidget));
// show hint about termianl size after resizing
view->setShowTerminalSizeHint(info->property<bool>(Profile::ShowTerminalSizeHint));
// terminal features
bool blinkingCursor = info->property<bool>(Profile::BlinkingCursorEnabled);
......
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