Skip to content
GitLab
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
33678e7c
Commit
33678e7c
authored
Mar 19, 2012
by
Jekyll Wu
Browse files
Add more convenient methods for accessing profile option
parent
6511de62
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/EditProfileDialog.cpp
View file @
33678e7c
...
...
@@ -269,11 +269,11 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr profile)
_ui
->
dirSelectButton
->
setIcon
(
KIcon
(
"folder-open"
));
_ui
->
iconSelectButton
->
setIcon
(
KIcon
(
profile
->
icon
()));
_ui
->
startInSameDirButton
->
setChecked
(
profile
->
property
<
bool
>
(
Profile
::
S
tartInCurrentSessionDir
));
_ui
->
startInSameDirButton
->
setChecked
(
profile
->
s
tartInCurrentSessionDir
(
));
// window options
_ui
->
showTerminalSizeHintButton
->
setChecked
(
profile
->
property
<
bool
>
(
Profile
::
S
howTerminalSizeHint
));
_ui
->
saveGeometryOnExitButton
->
setChecked
(
profile
->
property
<
bool
>
(
Profile
::
S
aveGeometryOnExit
));
_ui
->
showTerminalSizeHintButton
->
setChecked
(
profile
->
s
howTerminalSizeHint
(
));
_ui
->
saveGeometryOnExitButton
->
setChecked
(
profile
->
s
aveGeometryOnExit
(
));
// signals and slots
connect
(
_ui
->
dirSelectButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
selectInitialDir
()));
...
...
@@ -321,12 +321,11 @@ void EditProfileDialog::setupTabsPage(const Profile::Ptr profile)
// tab title format
_ui
->
tabTitleEdit
->
setClearButtonShown
(
true
);
_ui
->
remoteTabTitleEdit
->
setClearButtonShown
(
true
);
_ui
->
tabTitleEdit
->
setText
(
profile
->
property
<
QString
>
(
Profile
::
LocalTabTitleFormat
));
_ui
->
remoteTabTitleEdit
->
setText
(
profile
->
property
<
QString
>
(
Profile
::
RemoteTabTitleFormat
));
_ui
->
tabTitleEdit
->
setText
(
profile
->
localTabTitleFormat
());
_ui
->
remoteTabTitleEdit
->
setText
(
profile
->
remoteTabTitleFormat
());
// tab monitoring
int
silenceSeconds
=
profile
->
property
<
int
>
(
Profile
::
S
ilenceSeconds
);
int
silenceSeconds
=
profile
->
s
ilenceSeconds
(
);
_ui
->
silenceSecondsSpinner
->
setValue
(
silenceSeconds
);
_ui
->
silenceSecondsSpinner
->
setSuffix
(
ki18ncp
(
"Unit of time"
,
" second"
,
" seconds"
));
...
...
@@ -458,7 +457,7 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile)
SLOT
(
newColorScheme
()));
// setup font preview
bool
antialias
=
profile
->
property
<
bool
>
(
Profile
::
A
ntiAliasFonts
);
bool
antialias
=
profile
->
a
ntiAliasFonts
(
);
QFont
profileFont
=
profile
->
font
();
profileFont
.
setStyleStrategy
(
antialias
?
QFont
::
PreferAntialias
:
QFont
::
NoAntialias
);
...
...
@@ -478,7 +477,7 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile)
connect
(
_ui
->
antialiasTextButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
setAntialiasText
(
bool
)));
bool
boldIntense
=
profile
->
property
<
bool
>
(
Profile
::
B
oldIntense
);
bool
boldIntense
=
profile
->
b
oldIntense
(
);
_ui
->
boldIntenseButton
->
setChecked
(
boldIntense
);
connect
(
_ui
->
boldIntenseButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
setBoldIntense
(
bool
)));
...
...
@@ -974,7 +973,7 @@ void EditProfileDialog::setupScrollingPage(const Profile::Ptr profile)
setupRadio
(
types
,
scrollBackType
);
// setup scrollback line count spinner
int
historySize
=
profile
->
property
<
int
>
(
Profile
::
H
istorySize
);
int
historySize
=
profile
->
h
istorySize
(
);
_ui
->
scrollBackLinesSpinner
->
setValue
(
historySize
);
_ui
->
scrollBackLinesSpinner
->
setSingleStep
(
historySize
/
10
);
_ui
->
scrollBackLinesSpinner
->
setSuffix
(
ki18ncp
(
"Unit of scrollback"
,
" line"
,
" lines"
));
...
...
@@ -1039,7 +1038,7 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile)
setupCheckBoxes
(
options
,
profile
);
// interaction options
_ui
->
wordCharacterEdit
->
setText
(
profile
->
property
<
QString
>
(
Profile
::
W
ordCharacters
));
_ui
->
wordCharacterEdit
->
setText
(
profile
->
w
ordCharacters
(
));
connect
(
_ui
->
wordCharacterEdit
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
wordCharactersChanged
(
QString
)));
...
...
@@ -1051,12 +1050,12 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile)
SLOT
(
TripleClickModeChanged
(
int
)));
// cursor options
if
(
profile
->
property
<
bool
>
(
Profile
::
U
seCustomCursorColor
))
if
(
profile
->
u
seCustomCursorColor
(
))
_ui
->
customCursorColorButton
->
setChecked
(
true
);
else
_ui
->
autoCursorColorButton
->
setChecked
(
true
);
_ui
->
customColorSelectButton
->
setColor
(
profile
->
property
<
QColor
>
(
Profile
::
C
ustomCursorColor
));
_ui
->
customColorSelectButton
->
setColor
(
profile
->
c
ustomCursorColor
(
));
connect
(
_ui
->
customCursorColorButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
customCursorColor
()));
connect
(
_ui
->
autoCursorColorButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
autoCursorColor
()));
...
...
@@ -1073,7 +1072,7 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile)
_ui
->
selectEncodingButton
->
setMenu
(
codecAction
->
menu
());
connect
(
codecAction
,
SIGNAL
(
triggered
(
QTextCodec
*
)),
this
,
SLOT
(
setDefaultCodec
(
QTextCodec
*
)));
_ui
->
characterEncodingLabel
->
setText
(
profile
->
property
<
QString
>
(
Profile
::
D
efaultEncoding
));
_ui
->
characterEncodingLabel
->
setText
(
profile
->
d
efaultEncoding
(
));
}
void
EditProfileDialog
::
setDefaultCodec
(
QTextCodec
*
codec
)
...
...
src/MainWindow.cpp
View file @
33678e7c
...
...
@@ -445,8 +445,7 @@ Session* MainWindow::createSession(Profile::Ptr profile, const QString& director
Session
*
session
=
SessionManager
::
instance
()
->
createSession
(
profile
);
if
(
!
directory
.
isEmpty
()
&&
profile
->
property
<
bool
>
(
Profile
::
StartInCurrentSessionDir
))
if
(
!
directory
.
isEmpty
()
&&
profile
->
startInCurrentSessionDir
()
)
session
->
setInitialWorkingDirectory
(
directory
);
session
->
addEnvironmentEntry
(
QString
(
"KONSOLE_DBUS_WINDOW=/Windows/%1"
).
arg
(
_viewManager
->
managerId
())
);
...
...
src/Profile.h
View file @
33678e7c
...
...
@@ -28,6 +28,7 @@
#include
<QtCore/QStringList>
#include
<QtCore/QVariant>
#include
<QtGui/QFont>
#include
<QtGui/QColor>
// KDE
#include
<KSharedPtr>
...
...
@@ -331,6 +332,26 @@ public:
return
property
<
QStringList
>
(
Profile
::
Arguments
);
}
/** Convenience method for property<QString>(Profile::LocalTabTitleFormat) */
QString
localTabTitleFormat
()
const
{
return
property
<
QString
>
(
Profile
::
LocalTabTitleFormat
);
}
/** Convenience method for property<QString>(Profile::RemoteTabTitleFormat) */
QString
remoteTabTitleFormat
()
const
{
return
property
<
QString
>
(
Profile
::
RemoteTabTitleFormat
);
}
/** Convenience method for property<bool>(Profile::ShowTerminalSizeHint) */
bool
showTerminalSizeHint
()
const
{
return
property
<
bool
>
(
Profile
::
ShowTerminalSizeHint
);
}
/** Convenience method for property<bool>(Profile::SaveGeometryOnExit) */
bool
saveGeometryOnExit
()
const
{
return
property
<
bool
>
(
Profile
::
SaveGeometryOnExit
);
}
/** Convenience method for property<QFont>(Profile::Font) */
QFont
font
()
const
{
return
property
<
QFont
>
(
Profile
::
Font
);
...
...
@@ -346,6 +367,81 @@ public:
return
property
<
QStringList
>
(
Profile
::
Environment
);
}
/** Convenience method for property<QString>(Profile::KeyBindings) */
QString
keyBindings
()
const
{
return
property
<
QString
>
(
Profile
::
KeyBindings
);
}
/** Convenience method for property<QString>(Profile::HistorySize) */
int
historySize
()
const
{
return
property
<
int
>
(
Profile
::
HistorySize
);
}
/** Convenience method for property<bool>(Profile::BidiRenderingEnabled) */
bool
bidiRenderingEnabled
()
const
{
return
property
<
bool
>
(
Profile
::
BidiRenderingEnabled
);
}
/** Convenience method for property<bool>(Profile::BlinkingTextEnabled) */
bool
blinkingTextEnabled
()
const
{
return
property
<
bool
>
(
Profile
::
BlinkingTextEnabled
);
}
/** Convenience method for property<bool>(Profile::BlinkingCursorEnabled) */
bool
blinkingCursorEnabled
()
const
{
return
property
<
bool
>
(
Profile
::
BlinkingCursorEnabled
);
}
/** Convenience method for property<bool>(Profile::FlowControlEnabled) */
bool
flowControlEnabled
()
const
{
return
property
<
bool
>
(
Profile
::
FlowControlEnabled
);
}
/** Convenience method for property<bool>(Profile::UseCustomCursorColor) */
bool
useCustomCursorColor
()
const
{
return
property
<
bool
>
(
Profile
::
UseCustomCursorColor
);
}
/** Convenience method for property<bool>(Profile::CustomCursorColor) */
QColor
customCursorColor
()
const
{
return
property
<
QColor
>
(
Profile
::
CustomCursorColor
);
}
/** Convenience method for property<QString>(Profile::WordCharacters) */
QString
wordCharacters
()
const
{
return
property
<
QString
>
(
Profile
::
WordCharacters
);
}
/** Convenience method for property<bool>(Profile::UnderlineLinksEnabled) */
bool
underlineLinksEnabled
()
const
{
return
property
<
bool
>
(
Profile
::
UnderlineLinksEnabled
);
}
/** Convenience method for property<QString>(Profile::DefaultEncoding) */
QString
defaultEncoding
()
const
{
return
property
<
QString
>
(
Profile
::
DefaultEncoding
);
}
/** Convenience method for property<bool>(Profile::AntiAliasFonts) */
bool
antiAliasFonts
()
const
{
return
property
<
bool
>
(
Profile
::
AntiAliasFonts
);
}
/** Convenience method for property<bool>(Profile::BoldIntense) */
bool
boldIntense
()
const
{
return
property
<
bool
>
(
Profile
::
BoldIntense
);
}
/** Convenience method for property<bool>(Profile::StartInCurrentSessionDir) */
bool
startInCurrentSessionDir
()
const
{
return
property
<
bool
>
(
Profile
::
StartInCurrentSessionDir
);
}
/** Convenience method for property<QString>(Profile::SilenceSeconds) */
int
silenceSeconds
()
const
{
return
property
<
int
>
(
Profile
::
SilenceSeconds
);
}
/** Convenience method for property<QString>(Profile::MenuIndex) */
QString
menuIndex
()
const
{
return
property
<
QString
>
(
Profile
::
MenuIndex
);
...
...
src/SessionController.cpp
View file @
33678e7c
...
...
@@ -1091,7 +1091,7 @@ void SessionController::clearHistory()
void
SessionController
::
clearHistoryAndReset
()
{
Profile
::
Ptr
profile
=
SessionManager
::
instance
()
->
sessionProfile
(
_session
);
QByteArray
name
=
profile
->
property
<
QString
>
(
Profile
::
D
efaultEncoding
).
toUtf8
();
QByteArray
name
=
profile
->
d
efaultEncoding
(
).
toUtf8
();
Emulation
*
emulation
=
_session
->
emulation
();
emulation
->
reset
();
...
...
src/SessionManager.cpp
View file @
33678e7c
...
...
@@ -476,15 +476,15 @@ void SessionManager::applyProfile(Session* session, const Profile::Ptr profile ,
// Key bindings
if
(
apply
.
shouldApply
(
Profile
::
KeyBindings
))
session
->
setKeyBindings
(
profile
->
property
<
QString
>
(
Profile
::
K
eyBindings
));
session
->
setKeyBindings
(
profile
->
k
eyBindings
(
));
// Tab formats
if
(
apply
.
shouldApply
(
Profile
::
LocalTabTitleFormat
))
session
->
setTabTitleFormat
(
Session
::
LocalTabTitle
,
profile
->
property
<
QString
>
(
Profile
::
L
ocalTabTitleFormat
));
profile
->
l
ocalTabTitleFormat
(
));
if
(
apply
.
shouldApply
(
Profile
::
RemoteTabTitleFormat
))
session
->
setTabTitleFormat
(
Session
::
RemoteTabTitle
,
profile
->
property
<
QString
>
(
Profile
::
R
emoteTabTitleFormat
));
profile
->
r
emoteTabTitleFormat
(
));
// History
if
(
apply
.
shouldApply
(
Profile
::
HistoryMode
)
||
apply
.
shouldApply
(
Profile
::
HistorySize
))
{
...
...
@@ -495,7 +495,7 @@ void SessionManager::applyProfile(Session* session, const Profile::Ptr profile ,
break
;
case
Enum
::
FixedSizeHistory
:
{
int
lines
=
profile
->
property
<
int
>
(
Profile
::
H
istorySize
);
int
lines
=
profile
->
h
istorySize
(
);
session
->
setHistoryType
(
CompactHistoryType
(
lines
));
}
break
;
...
...
@@ -508,17 +508,17 @@ void SessionManager::applyProfile(Session* session, const Profile::Ptr profile ,
// Terminal features
if
(
apply
.
shouldApply
(
Profile
::
FlowControlEnabled
))
session
->
setFlowControlEnabled
(
profile
->
property
<
bool
>
(
Profile
::
F
lowControlEnabled
));
session
->
setFlowControlEnabled
(
profile
->
f
lowControlEnabled
(
));
// Encoding
if
(
apply
.
shouldApply
(
Profile
::
DefaultEncoding
))
{
QByteArray
name
=
profile
->
property
<
QString
>
(
Profile
::
D
efaultEncoding
).
toUtf8
();
QByteArray
name
=
profile
->
d
efaultEncoding
(
).
toUtf8
();
session
->
setCodec
(
QTextCodec
::
codecForName
(
name
));
}
// Monitor Silence
if
(
apply
.
shouldApply
(
Profile
::
SilenceSeconds
))
session
->
setMonitorSilenceSeconds
(
profile
->
property
<
int
>
(
Profile
::
S
ilenceSeconds
));
session
->
setMonitorSilenceSeconds
(
profile
->
s
ilenceSeconds
(
));
}
void
SessionManager
::
addProfile
(
Profile
::
Ptr
profile
)
...
...
src/ViewManager.cpp
View file @
33678e7c
...
...
@@ -765,7 +765,7 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
{
Q_ASSERT
(
profile
);
emit
setSaveGeometryOnExitRequest
(
profile
->
property
<
bool
>
(
Profile
::
S
aveGeometryOnExit
));
emit
setSaveGeometryOnExitRequest
(
profile
->
s
aveGeometryOnExit
(
));
emit
updateWindowIcon
();
...
...
@@ -778,8 +778,8 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
view
->
setWallpaper
(
colorScheme
->
wallpaper
());
// load font
view
->
setAntialias
(
profile
->
property
<
bool
>
(
Profile
::
A
ntiAliasFonts
));
view
->
setBoldIntense
(
profile
->
property
<
bool
>
(
Profile
::
B
oldIntense
));
view
->
setAntialias
(
profile
->
a
ntiAliasFonts
(
));
view
->
setBoldIntense
(
profile
->
b
oldIntense
(
));
view
->
setVTFont
(
profile
->
font
());
// set scroll-bar position
...
...
@@ -793,21 +793,21 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
view
->
setScrollBarPosition
(
Enum
::
ScrollBarHidden
);
// show hint about termianl size after resizing
view
->
setShowTerminalSizeHint
(
profile
->
property
<
bool
>
(
Profile
::
S
howTerminalSizeHint
));
view
->
setShowTerminalSizeHint
(
profile
->
s
howTerminalSizeHint
(
));
// terminal features
bool
blinkingCursor
=
profile
->
property
<
bool
>
(
Profile
::
B
linkingCursorEnabled
);
bool
blinkingCursor
=
profile
->
b
linkingCursorEnabled
(
);
view
->
setBlinkingCursorEnabled
(
blinkingCursor
);
bool
blinkingText
=
profile
->
property
<
bool
>
(
Profile
::
B
linkingTextEnabled
);
bool
blinkingText
=
profile
->
b
linkingTextEnabled
(
);
view
->
setBlinkingTextEnabled
(
blinkingText
);
int
tripleClickMode
=
profile
->
property
<
int
>
(
Profile
::
TripleClickMode
);
view
->
setTripleClickMode
(
Enum
::
TripleClickModeEnum
(
tripleClickMode
));
view
->
setUnderlineLinks
(
profile
->
property
<
bool
>
(
Profile
::
U
nderlineLinksEnabled
));
view
->
setUnderlineLinks
(
profile
->
u
nderlineLinksEnabled
(
));
bool
bidiEnabled
=
profile
->
property
<
bool
>
(
Profile
::
B
idiRenderingEnabled
);
bool
bidiEnabled
=
profile
->
b
idiRenderingEnabled
(
);
view
->
setBidiEnabled
(
bidiEnabled
);
// cursor shape
...
...
@@ -821,13 +821,13 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
view
->
setKeyboardCursorShape
(
Enum
::
UnderlineCursor
);
// cursor color
bool
useCustomColor
=
profile
->
property
<
bool
>
(
Profile
::
U
seCustomCursorColor
);
const
QColor
&
cursorColor
=
profile
->
property
<
QColor
>
(
Profile
::
C
ustomCursorColor
);
bool
useCustomColor
=
profile
->
u
seCustomCursorColor
(
);
const
QColor
&
cursorColor
=
profile
->
c
ustomCursorColor
(
);
view
->
setKeyboardCursorColor
(
!
useCustomColor
,
cursorColor
);
// word characters
view
->
setWordCharacters
(
profile
->
property
<
QString
>
(
Profile
::
W
ordCharacters
));
view
->
setWordCharacters
(
profile
->
w
ordCharacters
(
));
// bell mode
view
->
setBellMode
(
profile
->
property
<
int
>
(
Profile
::
BellMode
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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