Commit 6c5d38e7 authored by Robert Knight's avatar Robert Knight

Add menu items and shortcuts to increase and decrease font size. I have tried...

Add menu items and shortcuts to increase and decrease font size.  I have tried to keep as close as possible to the recommended Zoom In/Out shortcuts given that Ctrl+[Key] shortcuts cannot be used because they are reserved for terminal application use.  Ctrl++ zooms in, Ctrl+Shift+- zooms out.

svn path=/branches/work/konsole-split-view/; revision=655622
parent 76911d03
......@@ -9,6 +9,8 @@
<Action name="copy" group="session-edit-operations" />
<Action name="paste" group="session-edit-operations" />
<Separator group="session-edit-operations"/>
<Action name="send-input-to-all" group="session-edit-operations"/>
<Separator group="session-edit-operations"/>
<Action name="clear" group="session-edit-operations" />
<Action name="clear-and-reset" group="session-edit-operations" />
</Menu>
......@@ -26,6 +28,9 @@
<Menu name="view"><text>View</text>
<Action name="monitor-silence" group="session-view-operations" />
<Action name="monitor-activity" group="session-view-operations" />
<Separator group="session-view-operations"/>
<Action name="increase-text-size"/>
<Action name="decrease-text-size"/>
</Menu>
<!--<Menu name="debug"><text>Debug</text>
<Action name="debug-process"/>
......
......@@ -52,7 +52,7 @@
using namespace Konsole;
MainWindow::MainWindow()
: KMainWindow() ,
: KXmlGuiWindow() ,
_bookmarkHandler(0),
_pluggedController(0)
{
......@@ -62,12 +62,13 @@ MainWindow::MainWindow()
setContentsMargins(0,2,0,0);
// create actions for menus
setXMLFile("konsole/konsoleui.rc");
setupActions();
// create view manager
// the directory ('konsole') is included in the path here so that the XML
// file can be found when this code is being used in the Konsole part.
setXMLFile("konsole/konsoleui.rc");
//setXMLFile("konsole/konsoleui.rc");
_viewManager = new ViewManager(this,actionCollection());
connect( _viewManager , SIGNAL(empty()) , this , SLOT(close()) );
connect( _viewManager , SIGNAL(activeViewChanged(SessionController*)) , this ,
......
......@@ -20,7 +20,7 @@
#ifndef KONSOLEMAINWINDOW_H
#define KONSOLEMAINWINDOW_H
#include <KMainWindow>
#include <KXmlGuiWindow>
namespace Konsole
{
......@@ -43,7 +43,7 @@ class BookmarkHandler;
*
* Do not construct new main windows directly, use Application's newMainWindow() method.
*/
class MainWindow : public KMainWindow
class MainWindow : public KXmlGuiWindow
{
Q_OBJECT
......
......@@ -229,6 +229,7 @@ IncrementalSearchBar* SessionController::searchBar() const
void SessionController::setupActions()
{
QAction* action = 0;
KToggleAction* toggleAction = 0;
KActionCollection* collection = actionCollection();
// Close Session
......@@ -251,6 +252,11 @@ void SessionController::setupActions()
action->setShortcut( QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_V) );
connect( action , SIGNAL(triggered()) , this , SLOT(paste()) );
// Send to All
toggleAction = new KToggleAction(i18n("Send Input to All"),this);
action = collection->addAction("send-input-to-all",toggleAction);
connect( action , SIGNAL(triggered()) , this , SLOT(sendInputToAll()) );
// Clear and Clear+Reset
action = collection->addAction("clear");
action->setText( i18n("C&lear Display") );
......@@ -262,7 +268,6 @@ void SessionController::setupActions()
connect( action , SIGNAL(triggered()) , this , SLOT(clearAndReset()) );
// Monitor
KToggleAction* toggleAction = 0;
toggleAction = new KToggleAction(i18n("Monitor for &Activity"),this);
toggleAction->setShortcut( QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_A) );
action = collection->addAction("monitor-activity",toggleAction);
......@@ -273,6 +278,19 @@ void SessionController::setupActions()
action = collection->addAction("monitor-silence",toggleAction);
connect( action , SIGNAL(toggled(bool)) , this , SLOT(monitorSilence(bool)) );
// Text Size
action = collection->addAction("increase-text-size");
action->setText( i18n("Increase Text Size") );
action->setIcon( KIcon("zoom-in") );
action->setShortcut( QKeySequence(Qt::CTRL+Qt::Key_Plus) );
connect( action , SIGNAL(triggered()) , this , SLOT(increaseTextSize()) );
action = collection->addAction("decrease-text-size");
action->setText( i18n("Decrease Text Size") );
action->setIcon( KIcon("zoom-out") );
action->setShortcut( QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Minus) );
connect( action , SIGNAL(triggered()) , this , SLOT(decreaseTextSize()) );
// History
_searchToggleAction = new KAction(i18n("Search History"),this);
_searchToggleAction->setShortcut( QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_F) );
......@@ -536,6 +554,28 @@ void SessionController::clearHistoryAndReset()
clearAndReset();
clearHistory();
}
void SessionController::increaseTextSize()
{
QFont font = _view->getVTFont();
font.setPointSize(font.pointSize()+1);
_view->setVTFont(font);
//TODO - Save this setting as a session default
}
void SessionController::decreaseTextSize()
{
const int MinimumFontSize = 6;
QFont font = _view->getVTFont();
font.setPointSize( qMax(font.pointSize()-1,MinimumFontSize) );
_view->setVTFont(font);
//TODO - Save this setting as a session default
}
void SessionController::sendInputToAll()
{
Q_ASSERT(0); // Not implemented yet
}
void SessionController::monitorActivity(bool monitor)
{
_session->setMonitorActivity(monitor);
......
......@@ -120,6 +120,9 @@ private slots:
void closeSession();
void monitorActivity(bool monitor);
void monitorSilence(bool monitor);
void increaseTextSize();
void decreaseTextSize();
void sendInputToAll();
// other
void showDisplayContextMenu(TerminalDisplay* display , int state , int x , int y);
......
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