Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
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

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  }
CommandLineEdit * q
Definition: commandlineedit.cpp:141
void populateUi()
Definition: commandlineedit.cpp:114
std::size_t m_historyIndex
Definition: commandlineedit.cpp:144
std::unique_ptr< Ui::CommandLineEdit > ui
Definition: commandlineedit.cpp:142
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::CommandLineEditImpl ( const CommandLineEditImpl )
delete
geometrize::dialog::CommandLineEdit::CommandLineEditImpl::~CommandLineEditImpl ( )
default

Member Function Documentation

std::string geometrize::dialog::CommandLineEdit::CommandLineEditImpl::autoCompleteForCurrentInput ( )
inlineprivate
135  {
136  // TODO get possible autocompletes
137  const std::string current{getCurrentCommand()};
138  return "";
139  }
std::string getCurrentCommand() const
Definition: commandlineedit.cpp:119

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::clear ( )
inlineprivate
130  {
131  ui->lineEdit->clear();
132  }
std::unique_ptr< Ui::CommandLineEdit > ui
Definition: commandlineedit.cpp:142

Here is the caller graph for this function:

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::clearHistory ( )
inline
97  {
98  m_history.clear();
99  m_historyIndex = 0;
100  }
std::vector< std::string > m_history
Definition: commandlineedit.cpp:145
std::size_t m_historyIndex
Definition: commandlineedit.cpp:144
std::string geometrize::dialog::CommandLineEdit::CommandLineEditImpl::getCurrentCommand ( ) const
inlineprivate
120  {
121  return ui->lineEdit->text().toStdString();
122  }
std::unique_ptr< Ui::CommandLineEdit > ui
Definition: commandlineedit.cpp:142

Here is the caller graph for this function:

std::vector<std::string> geometrize::dialog::CommandLineEdit::CommandLineEditImpl::getHistory ( )
inline
71  {
72  return m_history;
73  }
std::vector< std::string > m_history
Definition: commandlineedit.cpp:145
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  }
void submitCommand()
Definition: commandlineedit.cpp:61
void stepHistory(const int steps)
Definition: commandlineedit.cpp:48
void setCurrentCommand(const std::string &command)
Definition: commandlineedit.cpp:124
std::string autoCompleteForCurrentInput()
Definition: commandlineedit.cpp:134

Here is the call graph for this function:

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::mouseDoubleClickEvent ( )
inline
103  {
104 
105  }
void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::onLanguageChange ( )
inline
108  {
109  populateUi();
110  ui->retranslateUi(q);
111  }
CommandLineEdit * q
Definition: commandlineedit.cpp:141
void populateUi()
Definition: commandlineedit.cpp:114
std::unique_ptr< Ui::CommandLineEdit > ui
Definition: commandlineedit.cpp:142

Here is the call graph for this function:

CommandLineEditImpl geometrize::dialog::CommandLineEdit::CommandLineEditImpl::operator= ( const CommandLineEditImpl )
delete
void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::populateUi ( )
inlineprivate
115  {
116 
117  }

Here is the caller graph for this function:

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setCompletionList ( const std::vector< std::string > &  completionList)
inline
88  {
89  QStringList words;
90  for(const std::string& word : completionList) {
91  words.push_back(QString::fromStdString(word));
92  }
93  ui->lineEdit->setCompletionList(words);
94  }
std::unique_ptr< Ui::CommandLineEdit > ui
Definition: commandlineedit.cpp:142
void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setCurrentCommand ( const std::string &  command)
inlineprivate
125  {
126  ui->lineEdit->setText(QString::fromStdString(command));
127  }
std::unique_ptr< Ui::CommandLineEdit > ui
Definition: commandlineedit.cpp:142

Here is the caller graph for this function:

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::setHistory ( const std::vector< std::string > &  history)
inline
76  {
77  m_history = history;
78  m_historyIndex = m_history.size();
79 
80  //QStringList words;
81  //for(const std::string& word : history) {
82  // words.push_back(QString::fromStdString(word));
83  //}
84  //ui->lineEdit->setCompletionList(words);
85  }
std::vector< std::string > m_history
Definition: commandlineedit.cpp:145
std::size_t m_historyIndex
Definition: commandlineedit.cpp:144
void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::stepHistory ( const int  steps)
inline
49  {
50  m_historyIndex = static_cast<std::size_t>(std::max(static_cast<std::int64_t>(0), static_cast<std::int64_t>(m_historyIndex) + steps));
51 
52  if(m_historyIndex == m_history.size()) {
54  } else if(!m_history.empty()) {
56  }
57 
59  }
std::vector< std::string > m_history
Definition: commandlineedit.cpp:145
std::string getCurrentCommand() const
Definition: commandlineedit.cpp:119
CommandLineEdit * q
Definition: commandlineedit.cpp:141
void signal_historyStepped(const std::string &)
signal_historyStepped is fired when the user steps through the command line history (e...
std::size_t m_historyIndex
Definition: commandlineedit.cpp:144
void setCurrentCommand(const std::string &command)
Definition: commandlineedit.cpp:124

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::dialog::CommandLineEdit::CommandLineEditImpl::submitCommand ( )
inline
62  {
63  const std::string command{getCurrentCommand()};
64  m_history.push_back(command);
65  clear();
66  m_historyIndex = static_cast<int>(m_history.size());
67  emit q->signal_commandSubmitted(command);
68  }
std::vector< std::string > m_history
Definition: commandlineedit.cpp:145
std::string getCurrentCommand() const
Definition: commandlineedit.cpp:119
void clear()
Definition: commandlineedit.cpp:129
CommandLineEdit * q
Definition: commandlineedit.cpp:141
std::size_t m_historyIndex
Definition: commandlineedit.cpp:144
void signal_commandSubmitted(const std::string &)
signal_commandSubmitted is fired when a command is submitted by the user (e.g. after pressing return)...

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

std::vector<std::string> geometrize::dialog::CommandLineEdit::CommandLineEditImpl::m_history
private
std::size_t geometrize::dialog::CommandLineEdit::CommandLineEditImpl::m_historyIndex
private
CommandLineEdit* geometrize::dialog::CommandLineEdit::CommandLineEditImpl::q
private
std::unique_ptr<Ui::CommandLineEdit> geometrize::dialog::CommandLineEdit::CommandLineEditImpl::ui
private

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