Commit 7ad55af1 authored by Jekyll Wu's avatar Jekyll Wu

Implement the "Seconds to detect silence" option from KDE3 konsole.

FEATURE: 195978
FIXED-IN:4.8
REVIEW:102823
parent 86786373
......@@ -343,6 +343,10 @@ void EditProfileDialog::setupTabsPage(const Profile::Ptr info)
_ui->remoteTabTitleEdit->setText(
info->property<QString>(Profile::RemoteTabTitleFormat));
// tab monitoring
int silenceSeconds = info->property<int>(Profile::SilenceSeconds);
_ui->silenceSecondsSpinner->setValue(silenceSeconds);
// tab bar options
int tabBarMode = info->property<int>(Profile::TabBarMode);
int tabBarPosition = info->property<int>(Profile::TabBarPosition);
......@@ -384,6 +388,9 @@ void EditProfileDialog::setupTabsPage(const Profile::Ptr info)
connect(_ui->remoteTabTitleEdit , SIGNAL(textChanged(QString)) , this ,
SLOT(remoteTabTitleFormatChanged(QString)));
connect( _ui->silenceSecondsSpinner , SIGNAL(valueChanged(int)) ,
this , SLOT(silenceSecondsChanged(int)) );
// menus for local and remote tab title dynamic elements
TabTitleFormatAction* localTabTitleAction = new TabTitleFormatAction(this);
localTabTitleAction->setContext(Session::LocalTabTitle);
......@@ -442,6 +449,11 @@ void EditProfileDialog::remoteTabTitleFormatChanged(const QString& format)
updateTempProfileProperty(Profile::RemoteTabTitleFormat,format);
}
void EditProfileDialog::silenceSecondsChanged(int seconds)
{
updateTempProfileProperty(Profile::SilenceSeconds, seconds);
}
void EditProfileDialog::selectIcon()
{
const QString& icon = KIconDialog::getIcon(KIconLoader::Desktop, KIconLoader::Application,
......
......@@ -121,6 +121,7 @@ private slots:
void showTerminalSizeHint(bool);
void saveGeometryOnExit(bool);
void showEnvironmentEditor();
void silenceSecondsChanged(int);
void tabBarVisibilityChanged(int);
void tabBarPositionChanged(int);
void newTabBehaviorChanged(int);
......
......@@ -422,6 +422,54 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_13">
<property name="title">
<string>Tab Monitoring</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="silenceSecondsLabel">
<property name="text">
<string>Seconds to detect silence:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KIntSpinBox" name="silenceSecondsSpinner">
<property name="toolTip">
<string>The threshold of detected silence in seconds</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>3600</number>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
......
......@@ -84,6 +84,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] =
, { StartInCurrentSessionDir , "StartInCurrentSessionDir" , GENERAL_GROUP , QVariant::Bool }
, { ShowNewAndCloseTabButtons, "ShowNewAndCloseTabButtons" , GENERAL_GROUP , QVariant::Bool }
, { MenuIndex, "MenuIndex" , GENERAL_GROUP , QVariant::String }
, { SilenceSeconds, "SilenceSeconds" , GENERAL_GROUP , QVariant::Int }
// Appearance
, { Font , "Font" , APPEARANCE_GROUP , QVariant::Font }
......@@ -166,6 +167,7 @@ FallbackProfile::FallbackProfile()
setProperty(StartInCurrentSessionDir,true);
setProperty(ShowNewAndCloseTabButtons,false);
setProperty(MenuIndex,"0");
setProperty(SilenceSeconds,10);
setProperty(KeyBindings,"default");
setProperty(ColorScheme,"Linux"); //use DarkPastels when is start support blue ncurses UI properly
......
......@@ -198,6 +198,8 @@ public:
StartInCurrentSessionDir,
/** (bool) Whether a 'New Tab' and 'Close Tab' buttons should be shown on the tab bar */
ShowNewAndCloseTabButtons,
/** (int) Specifies the threshold of detected silence in seconds. */
SilenceSeconds,
/** Index of profile in the File Menu
* In future, format will be #.#.# to account for levels
*/
......
......@@ -541,6 +541,10 @@ void SessionManager::applyProfile(Session* session, const Profile::Ptr profile ,
QByteArray name = profile->property<QString>(Profile::DefaultEncoding).toUtf8();
session->setCodec( QTextCodec::codecForName(name) );
}
// Monitor Silence
if ( apply.shouldApply(Profile::SilenceSeconds) )
session->setMonitorSilenceSeconds( profile->property<int>(Profile::SilenceSeconds) );
}
void SessionManager::addProfile(Profile::Ptr type)
......
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