Commit d1a1b117 authored by Jekyll Wu's avatar Jekyll Wu

Merge Profile::ScrollBarPositionEnum and TerminalDisplay::ScrollBarPosition...

Merge Profile::ScrollBarPositionEnum and TerminalDisplay::ScrollBarPosition into Enum::ScrollBarPositionEnum
parent 683f2c9e
......@@ -955,9 +955,9 @@ void EditProfileDialog::setupScrollingPage(const Profile::Ptr profile)
// setup scrollbar radio
int scrollBarPosition = profile->property<int>(Profile::ScrollBarPosition);
RadioOption positions[] = { {_ui->scrollBarHiddenButton, Profile::ScrollBarHidden, SLOT(hideScrollBar())},
{_ui->scrollBarLeftButton, Profile::ScrollBarLeft, SLOT(showScrollBarLeft())},
{_ui->scrollBarRightButton, Profile::ScrollBarRight, SLOT(showScrollBarRight())},
RadioOption positions[] = { {_ui->scrollBarHiddenButton, Enum::ScrollBarHidden, SLOT(hideScrollBar())},
{_ui->scrollBarLeftButton, Enum::ScrollBarLeft, SLOT(showScrollBarLeft())},
{_ui->scrollBarRightButton, Enum::ScrollBarRight, SLOT(showScrollBarRight())},
{0, 0, 0}
};
......@@ -1002,15 +1002,15 @@ void EditProfileDialog::unlimitedScrollBack()
}
void EditProfileDialog::hideScrollBar()
{
updateTempProfileProperty(Profile::ScrollBarPosition , Profile::ScrollBarHidden);
updateTempProfileProperty(Profile::ScrollBarPosition, Enum::ScrollBarHidden);
}
void EditProfileDialog::showScrollBarLeft()
{
updateTempProfileProperty(Profile::ScrollBarPosition , Profile::ScrollBarLeft);
updateTempProfileProperty(Profile::ScrollBarPosition, Enum::ScrollBarLeft);
}
void EditProfileDialog::showScrollBarRight()
{
updateTempProfileProperty(Profile::ScrollBarPosition , Profile::ScrollBarRight);
updateTempProfileProperty(Profile::ScrollBarPosition, Enum::ScrollBarRight);
}
void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile)
{
......
......@@ -8,8 +8,7 @@
accepted by the membership of KDE e.V. (or its successor appro-
ved by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
......@@ -50,6 +49,19 @@ public:
UnlimitedHistory = 2
};
/**
* This enum describes the positions where the terminal display's
* scroll bar may be placed.
*/
enum ScrollBarPositionEnum {
/** Show the scroll-bar on the left of the terminal display. */
ScrollBarLeft = 0,
/** Show the scroll-bar on the right of the terminal display. */
ScrollBarRight = 1,
/** Do not show the scroll-bar. */
ScrollBarHidden = 2
};
};
}
......
......@@ -161,7 +161,7 @@ FallbackProfile::FallbackProfile()
setProperty(HistoryMode, Enum::FixedSizeHistory);
setProperty(HistorySize, 1000);
setProperty(ScrollBarPosition, ScrollBarRight);
setProperty(ScrollBarPosition, Enum::ScrollBarRight);
setProperty(FlowControlEnabled, true);
setProperty(BlinkingTextEnabled, true);
......
......@@ -211,19 +211,6 @@ public:
MenuIndex
};
/**
* This enum describes the positions where the terminal display's
* scroll bar may be placed.
*/
enum ScrollBarPositionEnum {
/** Show the scroll-bar on the left of the terminal display. */
ScrollBarLeft = 0,
/** Show the scroll-bar on the right of the terminal display. */
ScrollBarRight = 1,
/** Do not show the scroll-bar. */
ScrollBarHidden = 2
};
/** This enum describes the shapes used to draw the cursor in terminal
* displays.
*/
......
......@@ -281,7 +281,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
, _lineSelectionMode(false)
, _preserveLineBreaks(false)
, _columnSelectionMode(false)
, _scrollbarLocation(ScrollBarRight)
, _scrollbarLocation(Enum::ScrollBarRight)
, _wordCharacters(":@-./_~")
, _bellMode(NotifyBell)
, _allowBlinkingText(true)
......@@ -783,7 +783,7 @@ void TerminalDisplay::scrollImage(int lines , const QRect& screenWindowRegion)
const int scrollBarWidth = _scrollBar->isHidden() ? 0 : _scrollBar->width();
const int SCROLLBAR_CONTENT_GAP = 1;
QRect scrollRect;
if (_scrollbarLocation == ScrollBarLeft) {
if (_scrollbarLocation == Enum::ScrollBarLeft) {
scrollRect.setLeft(scrollBarWidth + SCROLLBAR_CONTENT_GAP);
scrollRect.setRight(width());
} else {
......@@ -1180,7 +1180,7 @@ void TerminalDisplay::paintFilters(QPainter& painter)
QPoint cursorPos = mapFromGlobal(QCursor::pos());
int cursorLine;
int cursorColumn;
const int scrollBarWidth = (_scrollbarLocation == ScrollBarLeft) ? _scrollBar->width() : 0;
const int scrollBarWidth = (_scrollbarLocation == Enum::ScrollBarLeft) ? _scrollBar->width() : 0;
getCharacterPosition(cursorPos , cursorLine , cursorColumn);
Character cursorCharacter = _image[loc(cursorColumn, cursorLine)];
......@@ -1553,16 +1553,16 @@ void TerminalDisplay::calcGeometry()
{
_scrollBar->resize(_scrollBar->sizeHint().width(), contentsRect().height());
switch (_scrollbarLocation) {
case ScrollBarHidden :
case Enum::ScrollBarHidden :
_leftMargin = DEFAULT_LEFT_MARGIN;
_contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN;
break;
case ScrollBarLeft :
case Enum::ScrollBarLeft :
_leftMargin = DEFAULT_LEFT_MARGIN + _scrollBar->width();
_contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN - _scrollBar->width();
_scrollBar->move(contentsRect().topLeft());
break;
case ScrollBarRight:
case Enum::ScrollBarRight:
_leftMargin = DEFAULT_LEFT_MARGIN;
_contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN - _scrollBar->width();
_scrollBar->move(contentsRect().topRight() - QPoint(_scrollBar->width() - 1, 0));
......@@ -1642,12 +1642,12 @@ void TerminalDisplay::hideEvent(QHideEvent*)
/* */
/* ------------------------------------------------------------------------- */
void TerminalDisplay::setScrollBarPosition(ScrollBarPosition position)
void TerminalDisplay::setScrollBarPosition(Enum::ScrollBarPositionEnum position)
{
if (_scrollbarLocation == position)
return;
if (position == ScrollBarHidden)
if (position == Enum::ScrollBarHidden)
_scrollBar->hide();
else
_scrollBar->show();
......@@ -1787,7 +1787,7 @@ void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev)
int charColumn = 0;
getCharacterPosition(ev->pos(), charLine, charColumn);
const int scrollBarWidth = (_scrollbarLocation == ScrollBarLeft) ? _scrollBar->width() : 0;
const int scrollBarWidth = (_scrollbarLocation == Enum::ScrollBarLeft) ? _scrollBar->width() : 0;
// handle filters
// change link hot-spot appearance on mouse-over
......
......@@ -31,6 +31,7 @@
#include "konsole_export.h"
#include "ScreenWindow.h"
#include "ColorScheme.h"
#include "Enumeration.h"
class QDrag;
class QDragEnterEvent;
......@@ -91,22 +92,11 @@ public:
/** Sets the background picture */
void setWallpaper(ColorSchemeWallpaper::Ptr p);
/**
* This enum describes the location where the scroll bar is positioned in the display widget.
*/
enum ScrollBarPosition {
/** Show the scroll bar on the left side of the display. */
ScrollBarLeft = 0,
/** Show the scroll bar on the right side of the display. */
ScrollBarRight = 1,
/** Do not show the scroll bar. */
ScrollBarHidden = 2
};
/**
* Specifies whether the terminal display has a vertical scroll bar, and if so whether it
* is shown on the left or right side of the display.
*/
void setScrollBarPosition(ScrollBarPosition position);
void setScrollBarPosition(Enum::ScrollBarPositionEnum position);
/**
* Sets the current position and range of the display's scroll bar.
......@@ -798,7 +788,7 @@ private:
bool _columnSelectionMode;
QScrollBar* _scrollBar;
ScrollBarPosition _scrollbarLocation;
Enum::ScrollBarPositionEnum _scrollbarLocation;
QString _wordCharacters;
int _bellMode;
......
......@@ -47,6 +47,7 @@
#include "ViewContainer.h"
#include "ViewSplitter.h"
#include "Profile.h"
#include "Enumeration.h"
using namespace Konsole;
......@@ -784,12 +785,12 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
// set scroll-bar position
int scrollBarPosition = profile->property<int>(Profile::ScrollBarPosition);
if (scrollBarPosition == Profile::ScrollBarLeft)
view->setScrollBarPosition(TerminalDisplay::ScrollBarLeft);
else if (scrollBarPosition == Profile::ScrollBarRight)
view->setScrollBarPosition(TerminalDisplay::ScrollBarRight);
else if (scrollBarPosition == Profile::ScrollBarHidden)
view->setScrollBarPosition(TerminalDisplay::ScrollBarHidden);
if (scrollBarPosition == Enum::ScrollBarLeft)
view->setScrollBarPosition(Enum::ScrollBarLeft);
else if (scrollBarPosition == Enum::ScrollBarRight)
view->setScrollBarPosition(Enum::ScrollBarRight);
else if (scrollBarPosition == Enum::ScrollBarHidden)
view->setScrollBarPosition(Enum::ScrollBarHidden);
// show hint about termianl size after resizing
view->setShowTerminalSizeHint(profile->property<bool>(Profile::ShowTerminalSizeHint));
......
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