Commit 2739625d authored by Robert Knight's avatar Robert Knight

Allow the tab bar position to be specified in the profile editing dialog. ...

Allow the tab bar position to be specified in the profile editing dialog.  Other tweaks to the profile editing dialog.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=667497
parent 0ef9ea5f
......@@ -142,17 +142,28 @@ void EditProfileDialog::setupGeneralPage(const Profile* info)
_ui->remoteTabTitleEdit->setText(
info->property(Profile::RemoteTabTitleFormat).value<QString>());
// tab mode
// tab options
int tabMode = info->property(Profile::TabBarMode).value<int>();
int tabPosition = info->property(Profile::TabBarPosition).value<int>();
RadioOption tabModes[] = { {_ui->alwaysHideTabBarButton,Profile::AlwaysHideTabBar,
SLOT(alwaysHideTabBar()) },
{_ui->alwaysShowTabBarButton,Profile::AlwaysShowTabBar,
SLOT(alwaysShowTabBar()) },
{_ui->autoShowTabBarButton,Profile::ShowTabBarAsNeeded,
SLOT(showTabBarAsNeeded()) },
{0,0,0} };
setupRadio( tabModes , tabMode );
// note: Items should be in the same order as the
// Profile::TabBarModeEnum enum
_ui->tabBarVisibilityCombo->addItems( QStringList() << i18n("Always hide tab bar")
<< i18n("Show tab bar when needed")
<< i18n("Always show tab bar") );
_ui->tabBarVisibilityCombo->setCurrentIndex(tabMode);
// note: Items should be in the same order as the
// Profile::TabBarPositionEnum enum
_ui->tabBarPositionCombo->addItems( QStringList() << i18n("Below terminal displays")
<< i18n("Above terminal displays") );
_ui->tabBarPositionCombo->setCurrentIndex(tabPosition);
connect( _ui->tabBarVisibilityCombo , SIGNAL(activated(int)) , this ,
SLOT(tabBarVisibilityChanged(int)) );
connect( _ui->tabBarPositionCombo , SIGNAL(activated(int)) , this ,
SLOT(tabBarPositionChanged(int)) );
_ui->showMenuBarButton->setChecked( info->property(Profile::ShowMenuBar).value<bool>() );
......@@ -188,6 +199,14 @@ void EditProfileDialog::setupGeneralPage(const Profile* info)
connect(_ui->showMenuBarButton , SIGNAL(toggled(bool)) , this ,
SLOT(showMenuBar(bool)) );
}
void EditProfileDialog::tabBarVisibilityChanged(int newValue)
{
_tempProfile->setProperty( Profile::TabBarMode , newValue );
}
void EditProfileDialog::tabBarPositionChanged(int newValue)
{
_tempProfile->setProperty( Profile::TabBarPosition , newValue );
}
void EditProfileDialog::insertTabTitleText(const QString& text)
{
_ui->tabTitleEdit->insert(text);
......@@ -200,18 +219,6 @@ void EditProfileDialog::showMenuBar(bool show)
{
_tempProfile->setProperty(Profile::ShowMenuBar,show);
}
void EditProfileDialog::alwaysHideTabBar()
{
_tempProfile->setProperty(Profile::TabBarMode,Profile::AlwaysHideTabBar);
}
void EditProfileDialog::alwaysShowTabBar()
{
_tempProfile->setProperty(Profile::TabBarMode,Profile::AlwaysShowTabBar);
}
void EditProfileDialog::showTabBarAsNeeded()
{
_tempProfile->setProperty(Profile::TabBarMode,Profile::ShowTabBarAsNeeded);
}
void EditProfileDialog::tabTitleFormatChanged(const QString& format)
{
_tempProfile->setProperty(Profile::LocalTabTitleFormat,format);
......
......@@ -103,9 +103,8 @@ private slots:
void insertRemoteTabTitleText(const QString& text);
void showMenuBar(bool);
void alwaysHideTabBar();
void alwaysShowTabBar();
void showTabBarAsNeeded();
void tabBarVisibilityChanged(int);
void tabBarPositionChanged(int);
// appearance page
void setFontSize(int pointSize);
......
......@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>505</width>
<height>524</height>
<width>581</width>
<height>679</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -37,126 +37,138 @@
<attribute name="title" >
<string>General</string>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="profileNameLabel" >
<property name="text" >
<string>Profile name:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QLineEdit" name="profileNameEdit" >
<property name="toolTip" >
<string>A descriptive name for the profile</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Command:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="KLineEdit" name="commandEdit" >
<property name="toolTip" >
<string>The command to execute when new terminal sessions are created using this profile</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Initial directory:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="KLineEdit" name="initialDirEdit" >
<property name="toolTip" >
<string>The initial working directory for new terminal sessions using this profile</string>
</property>
</widget>
</item>
<item row="2" column="3" >
<widget class="QToolButton" name="dirSelectButton" >
<property name="toolTip" >
<string>Browse for initial directory</string>
</property>
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>Icon:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="iconSelectButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip" >
<string>Select the icon displayed on tabs using this profile</string>
</property>
<property name="text" >
<string/>
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="groupBox_10" >
<property name="title" >
<string>Basic Profile Options</string>
</property>
<property name="iconSize" >
<size>
<width>48</width>
<height>48</height>
</size>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="profileNameLabel" >
<property name="text" >
<string>Profile name:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QLineEdit" name="profileNameEdit" >
<property name="toolTip" >
<string>A descriptive name for the profile</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Command:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="KLineEdit" name="commandEdit" >
<property name="toolTip" >
<string>The command to execute when new terminal sessions are created using this profile</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Initial directory:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="KLineEdit" name="initialDirEdit" >
<property name="toolTip" >
<string>The initial working directory for new terminal sessions using this profile</string>
</property>
</widget>
</item>
<item row="2" column="3" >
<widget class="QToolButton" name="dirSelectButton" >
<property name="toolTip" >
<string>Browse for initial directory</string>
</property>
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>Icon:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="iconSelectButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip" >
<string>Select the icon displayed on tabs using this profile</string>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>48</width>
<height>48</height>
</size>
</property>
</widget>
</item>
<item row="3" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" colspan="4" >
<item>
<widget class="QGroupBox" name="groupBox_5" >
<property name="title" >
<string>Tab Titles</string>
......@@ -222,7 +234,7 @@
</layout>
</widget>
</item>
<item row="6" column="0" colspan="4" >
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Window &amp;&amp; Tab Bar Options</string>
......@@ -230,8 +242,8 @@
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QCheckBox" name="showMenuBarButton" >
<property name="toolTip" >
<string>Show or hide the menu bar in terminal windows using this profile</string>
......@@ -241,48 +253,52 @@
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="alwaysHideTabBarButton" >
<property name="toolTip" >
<string>Never show the tab bar</string>
</property>
<item row="1" column="0" >
<widget class="QLabel" name="label_12" >
<property name="text" >
<string>Always hide tab bar</string>
<string>Tab bar display:</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="autoShowTabBarButton" >
<property name="toolTip" >
<string>Hide or show the tab bar automatically depending on the number of tabs open</string>
<item row="1" column="1" >
<widget class="QComboBox" name="tabBarVisibilityCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_13" >
<property name="text" >
<string>Show tab bar when more than one tab is open</string>
<string>Tab bar position:</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="alwaysShowTabBarButton" >
<property name="toolTip" >
<string>Always show the tab bar</string>
</property>
<property name="text" >
<string>Always show tab bar</string>
<item row="2" column="1" >
<widget class="QComboBox" name="tabBarPositionCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="7" column="0" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
<width>95</width>
<height>61</height>
</size>
</property>
</spacer>
......@@ -468,63 +484,75 @@
<attribute name="title" >
<string>Keyboard Setup</string>
</attribute>
<layout class="QGridLayout" >
<item rowspan="5" row="0" column="0" >
<widget class="QListView" name="keyBindingList" />
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="newKeyBindingsButton" >
<property name="toolTip" >
<string>Create a new key bindings list based upon the selected bindings</string>
</property>
<property name="text" >
<string>New...</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="editKeyBindingsButton" >
<property name="toolTip" >
<string>Edit the selected key bindings list</string>
</property>
<property name="text" >
<string>Edit...</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="removeKeyBindingsButton" >
<property name="toolTip" >
<string>Delete the selected key bindings list</string>
</property>
<property name="text" >
<string>Remove</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="selectKeyBindingsButton" >
<property name="toolTip" >
<string>Use the selected key bindings list in this profile</string>
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="keyBindingsGroup" >
<property name="title" >
<string>Key Bindings</string>
</property>
<property name="text" >
<string>Select</string>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item rowspan="5" row="0" column="0" >
<widget class="QListView" name="keyBindingList" />
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="newKeyBindingsButton" >
<property name="toolTip" >
<string>Create a new key bindings list based upon the selected bindings</string>
</property>
<property name="text" >
<string>New...</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="editKeyBindingsButton" >
<property name="toolTip" >
<string>Edit the selected key bindings list</string>
</property>
<property name="text" >
<string>Edit...</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="removeKeyBindingsButton" >
<property name="toolTip" >
<string>Delete the selected key bindings list</string>
</property>
<property name="text" >
<string>Remove</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="selectKeyBindingsButton" >
<property name="toolTip" >
<string>Use the selected key bindings list in this profile</string>
</property>
<property name="text" >
<string>Select</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>71</width>
<height>101</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>75</width>
<height>331</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5" >
......
......@@ -51,6 +51,7 @@ FallbackProfile::FallbackProfile()
setProperty(LocalTabTitleFormat,"%d : %n");
setProperty(RemoteTabTitleFormat,"%H (%u)");
setProperty(TabBarMode,AlwaysShowTabBar);
setProperty(TabBarPosition,TabBarBottom);
setProperty(ShowMenuBar,true);
setProperty(KeyBindings,"default");
......@@ -186,6 +187,7 @@ bool KDE4ProfileWriter::writeProfile(const QString& path , const Profile* profil
// Menu and Tab Bar
writeStandardElement( general , "TabBarMode" , profile , Profile::TabBarMode );
writeStandardElement( general , "TabBarPosition" , profile , Profile::TabBarPosition );
writeStandardElement( general , "ShowMenuBar" , profile , Profile::ShowMenuBar );
// Keyboard
......@@ -260,6 +262,7 @@ bool KDE4ProfileReader::readProfile(const QString& path , Profile* profile)
readStandardElement<QString>(general,"RemoteTabTitleFormat",profile,Profile::RemoteTabTitleFormat);
readStandardElement<int>(general,"TabBarMode",profile,Profile::TabBarMode);
readStandardElement<int>(general,"TabBarPosition",profile,Profile::TabBarPosition);
readStandardElement<bool>(general,"ShowMenuBar",profile,Profile::ShowMenuBar);
// keyboard
......
......@@ -156,18 +156,34 @@ public:
/** TODO Document me */
// FIXME - Is this a duplicate of SelectWordCharacters?
WordCharacters // QString
WordCharacters, // QString
/** (TabBarPositionEnum) Position of the tab-bar relative to the terminal displays. */
TabBarPosition
};
/** This enum describes the available modes for showing or hiding the tab bar. */
/**
* This enum describes the available modes for showing or hiding the tab bar.
*/
enum TabBarModeEnum
{
/** The tab bar is never shown. */
AlwaysHideTabBar,
AlwaysHideTabBar = 0,
/** The tab bar is shown if there are multiple tabs open or hidden otherwise. */
ShowTabBarAsNeeded,
ShowTabBarAsNeeded = 1,
/** The tab bar is always shown. */
AlwaysShowTabBar
AlwaysShowTabBar = 2
};
/**
* This enum describes the available tab bar positions.
*/
enum TabBarPositionEnum
{
/** Show tab bar below displays. */
TabBarBottom = 0,
/** Show tab bar above displays. */
TabBarTop = 1
};
/**
......@@ -177,15 +193,15 @@ public:
enum HistoryModeEnum
{
/** No output is remembered. As soon as lines of text are scrolled off-screen they are lost. */
DisableHistory,
DisableHistory = 0,
/** A fixed number of lines of output are remembered. Once the limit is reached, the oldest
* lines are lost. */
FixedSizeHistory,
FixedSizeHistory = 1,
/** All output is remembered for the duration of the session.
* Typically this means that lines are recorded to
* a file as they are scrolled off-screen.
*/
UnlimitedHistory
UnlimitedHistory = 2
};
/**
......@@ -194,22 +210,22 @@ public:
enum ScrollBarPositionEnum
{
/** Show the scroll-bar on the left of the terminal display. */
ScrollBarLeft,
ScrollBarLeft = 0,
/** Show the scroll-bar on the right of the terminal display. */
ScrollBarRight,
ScrollBarRight = 1,
/** Do not show the scroll-bar. */
ScrollBarHidden
ScrollBarHidden = 2
};