summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <kurt.hindenburg@gmail.com>2016-09-17 01:57:27 (GMT)
committerKurt Hindenburg <kurt.hindenburg@gmail.com>2016-09-17 01:57:27 (GMT)
commit8e5a5b1ec1fb68e359319c9ce23a43c0434b836a (patch)
tree6484fb0e4c1d33c41d4ac178fbc4da13e28e1800
parent7a97832d9a02af74f179f761adbce704af761f3f (diff)
Allow profile to set margin and center flag
These 2 were hard coded - this allow them to be set in the profile. There is currently no UI for these; add these to profile: [General] TerminalMargin=1 TerminalCenter=false Thanks to Josef Kufner jk frozen doe net for patch It appears the center flag doesn't work and perhaps hasn't for a long time. BUG: 346450
-rw-r--r--src/Profile.cpp4
-rw-r--r--src/Profile.h14
-rw-r--r--src/TerminalDisplay.cpp3
-rw-r--r--src/ViewManager.cpp6
4 files changed, 24 insertions, 3 deletions
diff --git a/src/Profile.cpp b/src/Profile.cpp
index a8cec60..b3a50e0 100644
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -71,6 +71,8 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { SilenceSeconds, "SilenceSeconds" , GENERAL_GROUP , QVariant::Int }
, { TerminalColumns, "TerminalColumns" , GENERAL_GROUP , QVariant::Int }
, { TerminalRows, "TerminalRows" , GENERAL_GROUP , QVariant::Int }
+ , { TerminalMargin, "TerminalMargin" , GENERAL_GROUP , QVariant::Int }
+ , { TerminalCenter, "TerminalCenter" , GENERAL_GROUP , QVariant::Bool }
// Appearance
, { Font , "Font" , APPEARANCE_GROUP , QVariant::Font }
@@ -164,6 +166,8 @@ FallbackProfile::FallbackProfile()
setProperty(SilenceSeconds, 10);
setProperty(TerminalColumns, 80);
setProperty(TerminalRows, 24);
+ setProperty(TerminalMargin, 1);
+ setProperty(TerminalCenter, false);
setProperty(MouseWheelZoomEnabled, true);
setProperty(KeyBindings, "default");
diff --git a/src/Profile.h b/src/Profile.h
index 84a0acc..3e3aebf 100644
--- a/src/Profile.h
+++ b/src/Profile.h
@@ -248,6 +248,10 @@ public:
* In future, the format might be #.#.# to account for levels
*/
MenuIndex,
+ /** (int) Margin width in pixels */
+ TerminalMargin,
+ /** (bool) Center terminal when there is a margin */
+ TerminalCenter,
/** (bool) If true, mouse wheel scroll with Ctrl key pressed
* increases/decreases the terminal font size.
*/
@@ -505,6 +509,16 @@ public:
return property<int>(Profile::TerminalRows);
}
+ /** Convenience method for property<int>(Profile::TerminalMargin) */
+ int terminalMargin() const {
+ return property<int>(Profile::TerminalMargin);
+ }
+
+ /** Convenience method for property<bool>(Profile::TerminalCenter) */
+ bool terminalCenter() const {
+ return property<bool>(Profile::TerminalCenter);
+ }
+
/** Convenience method for property<QString>(Profile::MenuIndex) */
QString menuIndex() const {
return property<QString>(Profile::MenuIndex);
diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp
index 3c4364c2d..edbdc43 100644
--- a/src/TerminalDisplay.cpp
+++ b/src/TerminalDisplay.cpp
@@ -1898,6 +1898,9 @@ void TerminalDisplay::hideEvent(QHideEvent*)
void TerminalDisplay::setMargin(int margin)
{
+ if (margin < 0) {
+ margin = 0;
+ }
_margin = margin;
updateImageSize();
}
diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
index ba3b72e..e31041c 100644
--- a/src/ViewManager.cpp
+++ b/src/ViewManager.cpp
@@ -821,9 +821,9 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
else if (middleClickPasteMode == Enum::PasteFromClipboard)
view->setMiddleClickPasteMode(Enum::PasteFromClipboard);
- // margin/center - these are hard-fixed ATM
- view->setMargin(1);
- view->setCenterContents(false);
+ // margin/center
+ view->setMargin(profile->property<int>(Profile::TerminalMargin));
+ view->setCenterContents(profile->property<bool>(Profile::TerminalCenter));
// cursor shape
int cursorShape = profile->property<int>(Profile::CursorShape);