Geometrize  1.0
An application for geometrizing images into geometric primitives
commandlineedit.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 
6 #include <QWidget>
7 
8 class QEvent;
9 
10 namespace chaiscript
11 {
12 class ChaiScript;
13 }
14 
15 namespace geometrize
16 {
17 
18 namespace dialog
19 {
20 
24 class CommandLineEdit : public QWidget
25 {
26  Q_OBJECT
27 
28 public:
29  explicit CommandLineEdit(QWidget* parent = nullptr);
30  virtual ~CommandLineEdit();
31 
35  void clearHistory();
36 
41  std::vector<std::string> getHistory() const;
42 
47  void setHistory(const std::vector<std::string>& history);
48 
53  void setCompletionList(const std::vector<std::string>& completionList);
54 
55 signals:
59  void signal_commandSubmitted(const std::string&);
60 
64  void signal_historyStepped(const std::string&);
65 
66 protected:
67  void changeEvent(QEvent*) override;
68 
69 private:
70  virtual void keyPressEvent(QKeyEvent* e) override;
71  virtual bool focusNextPrevChild(bool next) override;
72  virtual void mouseDoubleClickEvent(QMouseEvent* event) override;
73 
74  class CommandLineEditImpl;
75  std::unique_ptr<CommandLineEditImpl> d;
76 };
77 
78 }
79 
80 }
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::keyPressEvent
void keyPressEvent(const int key)
Definition: commandlineedit.cpp:28
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::clear
void clear()
Definition: commandlineedit.cpp:130
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::q
CommandLineEdit * q
Definition: commandlineedit.cpp:142
geometrize::dialog::CommandLineEdit::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QMouseEvent *event) override
Definition: commandlineedit.cpp:187
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::autoCompleteForCurrentInput
std::string autoCompleteForCurrentInput()
Definition: commandlineedit.cpp:135
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::m_historyIndex
std::size_t m_historyIndex
Definition: commandlineedit.cpp:145
geometrize::dialog::CommandLineEdit::changeEvent
void changeEvent(QEvent *) override
Definition: commandlineedit.cpp:192
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setCompletionList
void setCompletionList(const std::vector< std::string > &completionList)
Definition: commandlineedit.cpp:88
geometrize::dialog::CommandLineEdit::signal_historyStepped
void signal_historyStepped(const std::string &)
signal_historyStepped is fired when the user steps through the command line history (e....
commandlineedit.h
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::ui
std::unique_ptr< Ui::CommandLineEdit > ui
Definition: commandlineedit.cpp:143
chaiscript
Definition: commandlineedit.h:11
geometrize::dialog::CommandLineEdit::~CommandLineEdit
virtual ~CommandLineEdit()
Definition: commandlineedit.cpp:153
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::stepHistory
void stepHistory(const int steps)
Definition: commandlineedit.cpp:48
geometrize::dialog::CommandLineEdit::clearHistory
void clearHistory()
clearHistory Wipe the history of commands entered this session.
Definition: commandlineedit.cpp:162
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setCurrentCommand
void setCurrentCommand(const std::string &command)
Definition: commandlineedit.cpp:125
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::mouseDoubleClickEvent
void mouseDoubleClickEvent()
Definition: commandlineedit.cpp:103
geometrize::dialog::CommandLineEdit::d
std::unique_ptr< CommandLineEditImpl > d
Definition: commandlineedit.h:74
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::onLanguageChange
void onLanguageChange()
Definition: commandlineedit.cpp:108
geometrize::dialog::CommandLineEdit::setHistory
void setHistory(const std::vector< std::string > &history)
setHistory Sets the history of commands.
Definition: commandlineedit.cpp:172
geometrize
Definition: commandlineparser.cpp:73
geometrize::dialog::CommandLineEdit::signal_commandSubmitted
void signal_commandSubmitted(const std::string &)
signal_commandSubmitted is fired when a command is submitted by the user (e.g. after pressing return)...
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::operator=
CommandLineEditImpl operator=(const CommandLineEditImpl &)=delete
geometrize::dialog::CommandLineEdit::keyPressEvent
virtual void keyPressEvent(QKeyEvent *e) override
Definition: commandlineedit.cpp:157
geometrize::dialog::CommandLineEdit::getHistory
std::vector< std::string > getHistory() const
getHistory Gets the history of commands entered this session, oldest first.
Definition: commandlineedit.cpp:167
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::~CommandLineEditImpl
~CommandLineEditImpl()=default
geometrize::dialog::CommandLineEdit
The CommandLineEdit class models the UI for the command line in a graphical script console.
Definition: commandlineedit.h:25
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::CommandLineEditImpl
CommandLineEditImpl(CommandLineEdit *pQ)
Definition: commandlineedit.cpp:19
geometrize::dialog::CommandLineEdit::focusNextPrevChild
virtual bool focusNextPrevChild(bool next) override
Definition: commandlineedit.cpp:182
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::CommandLineEditImpl
CommandLineEditImpl(const CommandLineEditImpl &)=delete
geometrize::dialog::CommandLineEdit::CommandLineEdit
CommandLineEdit(QWidget *parent=nullptr)
Definition: commandlineedit.cpp:149
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::m_history
std::vector< std::string > m_history
Definition: commandlineedit.cpp:146
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::populateUi
void populateUi()
Definition: commandlineedit.cpp:115
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::getHistory
std::vector< std::string > getHistory()
Definition: commandlineedit.cpp:71
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setHistory
void setHistory(const std::vector< std::string > &history)
Definition: commandlineedit.cpp:76
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::submitCommand
void submitCommand()
Definition: commandlineedit.cpp:62
geometrize::dialog::CommandLineEdit::setCompletionList
void setCompletionList(const std::vector< std::string > &completionList)
setCompletionList Sets the autocomplete list of commands.
Definition: commandlineedit.cpp:177
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::getCurrentCommand
std::string getCurrentCommand() const
Definition: commandlineedit.cpp:120
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::clearHistory
void clearHistory()
Definition: commandlineedit.cpp:97
geometrize::dialog::CommandLineEdit::CommandLineEditImpl
Definition: commandlineedit.cpp:17