Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
2c6b36ac
Commit
2c6b36ac
authored
May 04, 2007
by
Robert Knight
Browse files
Respect 'Show Menu Bar' and tab bar display mode profile settings.
svn path=/branches/work/konsole-split-view/; revision=660887
parent
cda9c083
Changes
8
Hide whitespace changes
Inline
Side-by-side
konsole/Application.cpp
View file @
2c6b36ac
...
...
@@ -147,7 +147,7 @@ void Application::detachView(Session* session)
void
Application
::
createSession
(
const
QString
&
key
,
ViewManager
*
view
)
{
Session
*
session
=
SessionManager
::
instance
()
->
createSession
(
key
);
// create view before starting the session process so that the session doesn't suffer
// a change in terminal size right after the session starts. some applications such as GNU Screen
// and Midnight Commander don't like this happening
...
...
konsole/EditProfileDialog.cpp
View file @
2c6b36ac
...
...
@@ -117,8 +117,8 @@ void EditProfileDialog::setupGeneralPage(const Profile* info)
int
tabMode
=
info
->
property
(
Profile
::
TabBarMode
).
value
<
int
>
();
RadioOption
tabModes
[]
=
{
{
_ui
->
alwaysHideTabBarButton
,
Profile
::
AlwaysHideTabBar
,
SLOT
(
alwaysHideTabBar
())},
{
_ui
->
alwaysShowTabBarButton
,
Profile
::
AlwaysShowTabBar
,
SLOT
(
s
howTabBar
AsNeeded
())},
{
_ui
->
autoShowTabBarButton
,
Profile
::
ShowTabBarAsNeeded
,
SLOT
(
alwaysS
howTabBar
())},
{
_ui
->
alwaysShowTabBarButton
,
Profile
::
AlwaysShowTabBar
,
SLOT
(
alwaysS
howTabBar
())},
{
_ui
->
autoShowTabBarButton
,
Profile
::
ShowTabBarAsNeeded
,
SLOT
(
s
howTabBar
AsNeeded
())},
{
0
,
0
,
0
}
};
setupRadio
(
tabModes
,
tabMode
);
...
...
konsole/MainWindow.cpp
View file @
2c6b36ac
...
...
@@ -76,6 +76,9 @@ MainWindow::MainWindow()
connect
(
_viewManager
,
SIGNAL
(
viewPropertiesChanged
(
const
QList
<
ViewProperties
*>&
))
,
bookmarkHandler
()
,
SLOT
(
setViews
(
const
QList
<
ViewProperties
*>&
))
);
connect
(
_viewManager
,
SIGNAL
(
setMenuBarVisible
(
bool
))
,
menuBar
()
,
SLOT
(
setVisible
(
bool
))
);
// create main window widgets
setupWidgets
();
...
...
konsole/MainWindow.h
View file @
2c6b36ac
...
...
@@ -34,6 +34,7 @@ class ViewSplitter;
class
ViewManager
;
class
ViewProperties
;
class
SessionController
;
class
Profile
;
class
ProfileList
;
class
BookmarkHandler
;
...
...
konsole/ViewContainer.cpp
View file @
2c6b36ac
...
...
@@ -49,10 +49,32 @@
using
namespace
Konsole
;
ViewContainer
::
ViewContainer
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_navigationDisplayMode
(
AlwaysShowNavigation
)
{
}
ViewContainer
::~
ViewContainer
()
{
emit
destroyed
(
this
);
}
void
ViewContainer
::
setNavigationDisplayMode
(
NavigationDisplayMode
mode
)
{
_navigationDisplayMode
=
mode
;
if
(
mode
==
AlwaysShowNavigation
)
qDebug
()
<<
"Always show nav"
;
else
if
(
mode
==
AlwaysHideNavigation
)
qDebug
()
<<
"Always hide nav"
;
else
if
(
mode
==
ShowNavigationAsNeeded
)
qDebug
()
<<
"Show nav as needed"
;
navigationDisplayModeChanged
(
mode
);
}
ViewContainer
::
NavigationDisplayMode
ViewContainer
::
navigationDisplayMode
()
const
{
return
_navigationDisplayMode
;
}
void
ViewContainer
::
addView
(
QWidget
*
view
,
ViewProperties
*
item
)
{
_views
<<
view
;
...
...
@@ -383,6 +405,28 @@ TabbedViewContainerV2::TabbedViewContainerV2(QObject* parent) : ViewContainer(pa
_containerWidget
->
setLayout
(
layout
);
}
void
TabbedViewContainerV2
::
navigationDisplayModeChanged
(
NavigationDisplayMode
mode
)
{
if
(
mode
==
AlwaysShowNavigation
&&
_tabBar
->
isHidden
()
)
_tabBar
->
setVisible
(
true
);
if
(
mode
==
AlwaysHideNavigation
&&
!
_tabBar
->
isHidden
()
)
_tabBar
->
setVisible
(
false
);
if
(
mode
==
ShowNavigationAsNeeded
)
dynamicTabBarVisibility
();
}
void
TabbedViewContainerV2
::
dynamicTabBarVisibility
()
{
qDebug
()
<<
"tab bar count:"
<<
_tabBar
->
count
();
qDebug
()
<<
"tab var hidden:"
<<
_tabBar
->
isHidden
();
if
(
_tabBar
->
count
()
>
1
&&
_tabBar
->
isHidden
()
)
_tabBar
->
show
();
if
(
_tabBar
->
count
()
<
2
&&
!
_tabBar
->
isHidden
()
)
_tabBar
->
hide
();
}
TabbedViewContainerV2
::~
TabbedViewContainerV2
()
{
_containerWidget
->
deleteLater
();
...
...
@@ -418,6 +462,9 @@ void TabbedViewContainerV2::addViewWidget( QWidget* view )
connect
(
item
,
SIGNAL
(
titleChanged
(
ViewProperties
*
))
,
this
,
SLOT
(
updateTitle
(
ViewProperties
*
)));
connect
(
item
,
SIGNAL
(
iconChanged
(
ViewProperties
*
)
)
,
this
,
SLOT
(
updateIcon
(
ViewProperties
*
)));
_tabBar
->
addTab
(
item
->
icon
()
,
item
->
title
()
);
if
(
navigationDisplayMode
()
==
ShowNavigationAsNeeded
)
dynamicTabBarVisibility
();
}
void
TabbedViewContainerV2
::
removeViewWidget
(
QWidget
*
view
)
{
...
...
@@ -427,6 +474,9 @@ void TabbedViewContainerV2::removeViewWidget( QWidget* view )
_stackWidget
->
removeWidget
(
view
);
_tabBar
->
removeTab
(
index
);
if
(
navigationDisplayMode
()
==
ShowNavigationAsNeeded
)
dynamicTabBarVisibility
();
}
void
TabbedViewContainerV2
::
updateTitle
(
ViewProperties
*
item
)
...
...
konsole/ViewContainer.h
View file @
2c6b36ac
...
...
@@ -68,7 +68,8 @@ class ViewContainer : public QObject
Q_OBJECT
public:
ViewContainer
(
QObject
*
parent
)
:
QObject
(
parent
)
{}
/** Constructs a new view container with the specified parent. */
ViewContainer
(
QObject
*
parent
);
/**
* Called when the ViewContainer is destroyed. When reimplementing this in
...
...
@@ -80,6 +81,22 @@ public:
/** Returns the widget which contains the view widgets */
virtual
QWidget
*
containerWidget
()
const
=
0
;
/**
* This enum describes the options for showing or hiding the
* container's navigation widget.
*/
enum
NavigationDisplayMode
{
AlwaysShowNavigation
,
AlwaysHideNavigation
,
ShowNavigationAsNeeded
};
/** TODO: Document me. */
void
setNavigationDisplayMode
(
NavigationDisplayMode
mode
);
/** TODO: Document me. */
NavigationDisplayMode
navigationDisplayMode
()
const
;
/** Adds a new view to the container widget */
void
addView
(
QWidget
*
view
,
ViewProperties
*
navigationItem
);
...
...
@@ -145,7 +162,13 @@ protected:
* from the container widget.
*/
virtual
void
removeViewWidget
(
QWidget
*
view
)
=
0
;
/**
* Called when the navigation display mode changes.
* See setNavigationDisplayMode
*/
virtual
void
navigationDisplayModeChanged
(
NavigationDisplayMode
)
{};
/** Returns the widgets which are associated with a particular navigation item */
QList
<
QWidget
*>
widgetsForItem
(
ViewProperties
*
item
)
const
;
...
...
@@ -153,6 +176,7 @@ private slots:
void
viewDestroyed
(
QObject
*
view
);
private:
NavigationDisplayMode
_navigationDisplayMode
;
QList
<
QWidget
*>
_views
;
QHash
<
QWidget
*
,
ViewProperties
*>
_navigation
;
};
...
...
@@ -235,6 +259,7 @@ public:
protected:
virtual
void
addViewWidget
(
QWidget
*
view
);
virtual
void
removeViewWidget
(
QWidget
*
view
);
virtual
void
navigationDisplayModeChanged
(
NavigationDisplayMode
mode
);
private
slots
:
void
updateTitle
(
ViewProperties
*
item
);
...
...
@@ -242,6 +267,8 @@ private slots:
void
currentTabChanged
(
int
index
);
private:
void
dynamicTabBarVisibility
();
ViewContainerTabBar
*
_tabBar
;
QStackedWidget
*
_stackWidget
;
QWidget
*
_containerWidget
;
...
...
konsole/ViewManager.cpp
View file @
2c6b36ac
...
...
@@ -511,6 +511,19 @@ void ViewManager::loadViewSettings(TerminalDisplay* view , Profile* info)
colorScheme
=
ColorSchemeManager
::
instance
()
->
defaultColorScheme
();
Q_ASSERT
(
colorScheme
);
// menu bar visibility
emit
setMenuBarVisible
(
info
->
property
(
Profile
::
ShowMenuBar
).
value
<
bool
>
()
);
// tab bar visibility
ViewContainer
*
container
=
_viewSplitter
->
activeContainer
();
int
tabBarMode
=
info
->
property
(
Profile
::
TabBarMode
).
value
<
int
>
();
if
(
tabBarMode
==
Profile
::
AlwaysHideTabBar
)
container
->
setNavigationDisplayMode
(
ViewContainer
::
AlwaysHideNavigation
);
else
if
(
tabBarMode
==
Profile
::
AlwaysShowTabBar
)
container
->
setNavigationDisplayMode
(
ViewContainer
::
AlwaysShowNavigation
);
else
if
(
tabBarMode
==
Profile
::
ShowTabBarAsNeeded
)
container
->
setNavigationDisplayMode
(
ViewContainer
::
ShowNavigationAsNeeded
);
// load colour scheme
view
->
setColorTable
(
colorScheme
->
colorTable
());
...
...
konsole/ViewManager.h
View file @
2c6b36ac
...
...
@@ -131,6 +131,9 @@ signals:
// 'multipleViews' - true if the manager has multiple containers or false otherwise
void
splitViewToggle
(
bool
multipleViews
);
/** TODO: Document me. */
void
setMenuBarVisible
(
bool
);
private
slots
:
// called when the "Split View Left/Right" menu item is selected
void
splitLeftRight
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment