#include <commandwindow.h>
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 |
Class representing command window
The window allow editation of command and show output of previously executed commands
| gui::CommandWindow::CommandWindow | ( | QWidget * | parent = 0, |
|
| const char * | name = 0 | |||
| ) |
constructor of CommandWindow, creates window and fills it with elements
| 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().
| void gui::CommandWindow::addCommand | ( | const QString & | command | ) |
Add command executed from menu or any source to be echoed to command window
| 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
| 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
| 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
| 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
| from | Source of the command |
References CmdEditor, commandExecuted(), history, and in.
| void gui::CommandWindow::hideCmdEditor | ( | bool | hide = true |
) | [slot] |
| void gui::CommandWindow::hideCmdHistory | ( | bool | hide = true |
) | [slot] |
| void gui::CommandWindow::hideCmdLine | ( | bool | hide = true |
) | [slot] |
Enable/disable command history editability
| 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] |
Load command history
References gui::CMD, debug::DBG_INFO, gui::DEFAULT__HISTORYFILE, gui::DEFAULT__HISTORYFILEITEMSEPARATOR, gui::globalSettings, guiPrintDbg, history, gui::HISTORYFILE, gui::HISTORYFILEITEMSEPARATOR, and gui::Settings::readExpand().
Referenced by CommandWindow().
| void gui::CommandWindow::reloadSettings | ( | ) |
Load/reload show/hide settings from global settings and apply them to this widget
References gui::CMD, gui::CMDSHOWEDITOR, gui::CMDSHOWHISTORY, gui::CMDSHOWLINE, gui::DEFAULT__CMDSHOWEDITOR, gui::DEFAULT__CMDSHOWHISTORY, gui::DEFAULT__CMDSHOWLINE, gui::globalSettings, history, in, gui::Settings::readBool(), showCmdEditor(), showCmdHistory(), and showCmdLine().
Referenced by CommandWindow().
| void gui::CommandWindow::restoreWindowState | ( | ) |
Restores window state from application settings
References gui::globalSettings, gui::Settings::restoreSplitter(), and spl.
| void gui::CommandWindow::saveHistory | ( | ) | [slot] |
Save current command history
References gui::CMD, debug::DBG_INFO, gui::DEFAULT__HISTORYFILE, gui::DEFAULT__HISTORYFILEITEMSEPARATOR, gui::globalSettings, guiPrintDbg, history, gui::HISTORYFILE, gui::HISTORYFILEITEMSEPARATOR, Q_ListBoxItem, and gui::Settings::readExpand().
Referenced by ~CommandWindow().
| 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
Referenced by CommandWindow().
| void gui::CommandWindow::setHistoryFile | ( | const QString & | historyFile | ) | [slot] |
Set file to store history and write it to settings
| 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
| 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
| 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
| 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
| 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
| show | True to enable editing, false to act only as list |
Referenced by hideCmdLine(), and reloadSettings().
QLineEdit* gui::CommandWindow::cmd [private] |
Commandline widget
Q_ComboBox* gui::CommandWindow::history [private] |
History widget
Referenced by CommandWindow(), eventFilter(), execute(), isShownCmdHistory(), loadHistory(), reloadSettings(), saveHistory(), selectedHistoryItem(), setHistorySize(), and showCmdHistory().
QSEditor* gui::CommandWindow::in [private] |
Script editor widget
Referenced by CommandWindow(), eventFilter(), execute(), isShownCmdEditor(), reloadSettings(), selectedHistoryItem(), setInterpreter(), and showCmdEditor().
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().