gui::CommandWindow Class Reference

#include <commandwindow.h>

List of all members.

Public Types

enum  cmd { CmdNone = 0, CmdHistory = 1, CmdLine = 2, CmdEditor = 4 }

Public Slots

void execute ()
void setHistorySize (int historySize)
void setHistoryFile (const QString &historyFile)
void setInterpreter (QSInterpreter *ainterpreter, QObject *context)
void loadHistory ()
void saveHistory ()
void hideCmdHistory (bool hide=true)
void hideCmdLine (bool hide=true)
void hideCmdEditor (bool hide=true)
void showCmdHistory (bool show=true)
void showCmdLine (bool show=true)
void showCmdEditor (bool show=true)
bool isShownCmdHistory ()
bool isShownCmdLine ()
bool isShownCmdEditor ()

Signals

void commandExecuted (QString)

Public Member Functions

 CommandWindow (QWidget *parent=0, const char *name=0)
void addCommand (const QString &command)
void addError (const QString &message)
void addString (const QString &str)
virtual bool eventFilter (QObject *o, QEvent *e)
void reloadSettings ()
void saveWindowState ()
void restoreWindowState ()
void clearWindow ()
 ~CommandWindow ()
void execute (enum cmd from)

Private Slots

void selectedHistoryItem (int)

Private Attributes

Q_TextEdit * out
QLineEdit * cmd
QSEditor * in
Q_ComboBox * history
QSInterpreter * interpreter
QSplitter * spl

Detailed Description

Class representing command window
The window allow editation of command and show output of previously executed commands


Member Enumeration Documentation

Source of command

Enumerator:
CmdNone 
CmdHistory 
CmdLine 
CmdEditor 

Constructor & Destructor Documentation

gui::CommandWindow::CommandWindow ( QWidget *  parent = 0,
const char *  name = 0 
)

constructor of CommandWindow, creates window and fills it with elements

Parameters:
parent Parent widget
name Name of the widget (used for debugging)

References gui::CMD, gui::DEFAULT__HISTORYSIZE, execute(), gui::globalSettings, history, gui::HISTORYSIZE, in, interpreter, loadHistory(), out, Q_ComboBox, Q_TextEdit, gui::Settings::readNum(), reloadSettings(), selectedHistoryItem(), and spl.

gui::CommandWindow::~CommandWindow (  ) 

default destructor

References saveHistory().


Member Function Documentation

void gui::CommandWindow::addCommand ( const QString &  command  ) 

Add command executed from menu or any source to be echoed to command window

Parameters:
command Command to add

References util::consoleLog(), gui::globalSettings, util::htmlEnt(), out, and gui::Settings::readExpand().

Referenced by gui::ConsoleWriterGui::printCommand().

void gui::CommandWindow::addError ( const QString &  message  ) 

Add error message to be echoed to command window

Parameters:
message Error message to add

References util::consoleLog(), gui::globalSettings, util::htmlEnt(), out, and gui::Settings::readExpand().

Referenced by gui::ConsoleWriterGui::printErrorLine().

void gui::CommandWindow::addString ( const QString &  str  ) 

Add string to be echoed to command window

Parameters:
str String to add

References util::consoleLog(), gui::globalSettings, util::htmlEnt(), out, and gui::Settings::readExpand().

Referenced by gui::ConsoleWriterGui::printLine().

void gui::CommandWindow::clearWindow (  ) 

Erase all text in the window

References out.

void gui::CommandWindow::commandExecuted ( QString   )  [signal]

Signal emitted when command is executed from this command window

Referenced by execute().

bool gui::CommandWindow::eventFilter ( QObject *  o,
QEvent *  e 
) [virtual]

Overloaded QObject::eventFilter This function will filter events for various widgets inside the commandwindow

Parameters:
o Watched object
e Event

References CmdEditor, execute(), history, in, and interpreter.

void gui::CommandWindow::execute (  )  [slot]

Execute and clear current command (invoked from commandline as source)

References CmdLine.

Referenced by CommandWindow(), and eventFilter().

void gui::CommandWindow::execute ( enum cmd  from  ) 

Execute and clear current command

Parameters:
from Source of the command

References CmdEditor, commandExecuted(), history, and in.

void gui::CommandWindow::hideCmdEditor ( bool  hide = true  )  [slot]

Show/hide command editor

Parameters:
hide True to hide, false to show

References showCmdEditor().

void gui::CommandWindow::hideCmdHistory ( bool  hide = true  )  [slot]

Show/hide command history

Parameters:
hide True to hide, false to show

References showCmdHistory().

void gui::CommandWindow::hideCmdLine ( bool  hide = true  )  [slot]

Enable/disable command history editability

Parameters:
hide False to enable editing, true to act only as list

References showCmdLine().

bool gui::CommandWindow::isShownCmdEditor (  )  [slot]

Return true, if command editor is shown

References in.

bool gui::CommandWindow::isShownCmdHistory (  )  [slot]

Return true, if command history is shown

References history.

bool gui::CommandWindow::isShownCmdLine (  )  [slot]

Return true, if command history is editable

void gui::CommandWindow::loadHistory (  )  [slot]
void gui::CommandWindow::reloadSettings (  ) 
void gui::CommandWindow::restoreWindowState (  ) 

Restores window state from application settings

References gui::globalSettings, gui::Settings::restoreSplitter(), and spl.

void gui::CommandWindow::saveHistory (  )  [slot]
void gui::CommandWindow::saveWindowState (  ) 

Saves command state to application settings

References gui::globalSettings, gui::Settings::saveSplitter(), and spl.

void gui::CommandWindow::selectedHistoryItem ( int   )  [private, slot]

Slot called when a history item from drop-down box is selected

References history, and in.

Referenced by CommandWindow().

void gui::CommandWindow::setHistoryFile ( const QString &  historyFile  )  [slot]

Set file to store history and write it to settings

Parameters:
historyFile file fopr storing history

References gui::CMD, debug::DBG_INFO, gui::globalSettings, guiPrintDbg, gui::HISTORYFILE, and gui::Settings::write().

void gui::CommandWindow::setHistorySize ( int  historySize  )  [slot]

Set maximal history size and write it to settings

Parameters:
historySize maximal history size (in lines)

References gui::CMD, debug::DBG_INFO, gui::globalSettings, guiPrintDbg, history, gui::HISTORYSIZE, and gui::Settings::write().

void gui::CommandWindow::setInterpreter ( QSInterpreter *  ainterpreter,
QObject *  context 
) [slot]

Set interpreter and context for script editor

Parameters:
ainterpreter QSInterpreter instance
context Context in which scripts are executed

References in, and interpreter.

void gui::CommandWindow::showCmdEditor ( bool  show = true  )  [slot]

Show/hide command editor

Parameters:
show True to show, false to hide

References in.

Referenced by hideCmdEditor(), and reloadSettings().

void gui::CommandWindow::showCmdHistory ( bool  show = true  )  [slot]

Show/hide command history

Parameters:
show True to show, false to hide

References history.

Referenced by hideCmdHistory(), and reloadSettings().

void gui::CommandWindow::showCmdLine ( bool  show = true  )  [slot]

Enable/disable command history editability

Parameters:
show True to enable editing, false to act only as list

Referenced by hideCmdLine(), and reloadSettings().


Member Data Documentation

QLineEdit* gui::CommandWindow::cmd [private]

Commandline widget

Q_ComboBox* gui::CommandWindow::history [private]
QSEditor* gui::CommandWindow::in [private]
QSInterpreter* gui::CommandWindow::interpreter [private]

Interpreter

Referenced by CommandWindow(), eventFilter(), and setInterpreter().

Q_TextEdit* gui::CommandWindow::out [private]

Console widget

Referenced by addCommand(), addError(), addString(), clearWindow(), and CommandWindow().

QSplitter* gui::CommandWindow::spl [private]

Vetical splitter between (out + command line) and command editor

Referenced by CommandWindow(), restoreWindowState(), and saveWindowState().


The documentation for this class was generated from the following files: