Geometrize  1.0
An application for geometrizing images into geometric primitives
Public Member Functions | Private Member Functions | Private Attributes | List of all members
geometrize::dialog::CommandLineEdit::CommandLineEditImpl Class Reference
Collaboration diagram for geometrize::dialog::CommandLineEdit::CommandLineEditImpl:
Collaboration graph
[legend]

Public Member Functions

 CommandLineEditImpl (CommandLineEdit *pQ)
 
CommandLineEditImpl operator= (const CommandLineEditImpl &)=delete
 
 CommandLineEditImpl (const CommandLineEditImpl &)=delete
 
 ~CommandLineEditImpl ()=default
 
void keyPressEvent (const int key)
 
void stepHistory (const int steps)
 
void submitCommand ()
 
std::vector< std::string > getHistory ()
 
void setHistory (const std::vector< std::string > &history)
 
void setCompletionList (const std::vector< std::string > &completionList)
 
void clearHistory ()
 
void mouseDoubleClickEvent ()
 
void onLanguageChange ()
 

Private Member Functions

void populateUi ()
 
std::string getCurrentCommand () const
 
void setCurrentCommand (const std::string &command)
 
void clear ()
 
std::string autoCompleteForCurrentInput ()
 

Private Attributes

CommandLineEditq
 
std::unique_ptr< Ui::CommandLineEdit > ui
 
std::size_t m_historyIndex
 
std::vector< std::string > m_history
 

Constructor & Destructor Documentation

◆ CommandLineEditImpl() [1/2]

geometrize::dialog::CommandLineEdit::CommandLineEditImpl::CommandLineEditImpl ( CommandLineEdit pQ)
inline
19  : q{pQ}, ui{std::make_unique<Ui::CommandLineEdit>()}, m_historyIndex{0}
20  {
21  ui->setupUi(q);
22  populateUi();
23  }

◆ CommandLineEditImpl() [2/2]

geometrize::dialog::CommandLineEdit::CommandLineEditImpl::CommandLineEditImpl ( const CommandLineEditImpl )
delete

◆ ~CommandLineEditImpl()

geometrize::dialog::CommandLineEdit::CommandLineEditImpl::~CommandLineEditImpl ( )
default

Member Function Documentation

◆ autoCompleteForCurrentInput()

std::string geometrize::dialog::CommandLineEdit::CommandLineEditImpl::autoCompleteForCurrentInput ( )
inlineprivate
136  {
137  // TODO get possible autocompletes
138  const std::string current{getCurrentCommand()};
139  return "";
140  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::clear ( )
inlineprivate
131  {
132  ui->lineEdit->clear();
133  }
Here is the caller graph for this function:

◆ clearHistory()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::clearHistory ( )
inline
98  {
99  m_history.clear();
100  m_historyIndex = 0;
101  }

◆ getCurrentCommand()

std::string geometrize::dialog::CommandLineEdit::CommandLineEditImpl::getCurrentCommand ( ) const
inlineprivate
121  {
122  return ui->lineEdit->text().toStdString();
123  }
Here is the caller graph for this function:

◆ getHistory()

std::vector<std::string> geometrize::dialog::CommandLineEdit::CommandLineEditImpl::getHistory ( )
inline
72  {
73  return m_history;
74  }

◆ keyPressEvent()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::keyPressEvent ( const int  key)
inline
29  {
30  switch(key) {
31  case Qt::Key_Up:
32  stepHistory(-1);
33  break;
34  case Qt::Key_Down:
35  stepHistory(1);
36  break;
37  case Qt::Key_Return:
38  submitCommand();
39  break;
40  case Qt::Key_Tab:
42  break;
43  default:
44  break;
45  }
46  }
Here is the call graph for this function:

◆ mouseDoubleClickEvent()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::mouseDoubleClickEvent ( )
inline
104  {
105 
106  }

◆ onLanguageChange()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::onLanguageChange ( )
inline
109  {
110  populateUi();
111  ui->retranslateUi(q);
112  }
Here is the call graph for this function:

◆ operator=()

CommandLineEditImpl geometrize::dialog::CommandLineEdit::CommandLineEditImpl::operator= ( const CommandLineEditImpl )
delete

◆ populateUi()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::populateUi ( )
inlineprivate
116  {
117 
118  }
Here is the caller graph for this function:

◆ setCompletionList()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setCompletionList ( const std::vector< std::string > &  completionList)
inline
89  {
90  QStringList words;
91  for(const std::string& word : completionList) {
92  words.push_back(QString::fromStdString(word));
93  }
94  ui->lineEdit->setCompletionList(words);
95  }

◆ setCurrentCommand()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setCurrentCommand ( const std::string &  command)
inlineprivate
126  {
127  ui->lineEdit->setText(QString::fromStdString(command));
128  }
Here is the caller graph for this function:

◆ setHistory()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setHistory ( const std::vector< std::string > &  history)
inline
77  {
78  m_history = history;
79  m_historyIndex = m_history.size();
80 
81  //QStringList words;
82  //for(const std::string& word : history) {
83  // words.push_back(QString::fromStdString(word));
84  //}
85  //ui->lineEdit->setCompletionList(words);
86  }

◆ stepHistory()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::stepHistory ( const int  steps)
inline
49  {
50  m_historyIndex = static_cast<std::size_t>(std::min(static_cast<std::int64_t>(m_history.size()),
51  std::max(static_cast<std::int64_t>(0), static_cast<std::int64_t>(m_historyIndex) + steps)));
52 
53  if(m_historyIndex == m_history.size()) {
55  } else if(!m_history.empty()) {
57  }
58 
60  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ submitCommand()

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::submitCommand ( )
inline
63  {
64  const std::string command{getCurrentCommand()};
65  m_history.push_back(command);
66  clear();
67  m_historyIndex = static_cast<int>(m_history.size());
68  emit q->signal_commandSubmitted(command);
69  }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_history

std::vector<std::string> geometrize::dialog::CommandLineEdit::CommandLineEditImpl::m_history
private

◆ m_historyIndex

std::size_t geometrize::dialog::CommandLineEdit::CommandLineEditImpl::m_historyIndex
private

◆ q

CommandLineEdit* geometrize::dialog::CommandLineEdit::CommandLineEditImpl::q
private

◆ ui

std::unique_ptr<Ui::CommandLineEdit> geometrize::dialog::CommandLineEdit::CommandLineEditImpl::ui
private

The documentation for this class was generated from the following file:
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::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::signal_historyStepped
void signal_historyStepped(const std::string &)
signal_historyStepped is fired when the user steps through the command line history (e....
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::ui
std::unique_ptr< Ui::CommandLineEdit > ui
Definition: commandlineedit.cpp:143
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::stepHistory
void stepHistory(const int steps)
Definition: commandlineedit.cpp:48
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setCurrentCommand
void setCurrentCommand(const std::string &command)
Definition: commandlineedit.cpp:125
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::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::submitCommand
void submitCommand()
Definition: commandlineedit.cpp:62
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::getCurrentCommand
std::string getCurrentCommand() const
Definition: commandlineedit.cpp:120