26 #if defined (HAVE_CONFIG_H)
30 #include <QApplication>
36 #include <QVBoxLayout>
53 setStatusTip (tr (
"Browse and search the command history."));
56 p, SLOT (new_file (
const QString&)));
58 connect (
this, SIGNAL (
information (
const QString&)),
59 p, SLOT (report_status_message (
const QString&)));
62 p, SLOT (execute_command_in_terminal (
const QString&)));
76 lst.append (hist_entry);
80 bool at_bottom = scroll_bar->maximum () - scroll_bar->value () < 1;
106 for (
int i = 0; i <
m_filter->count (); i++)
107 mru.append (
m_filter->itemText (i));
144 if (index.isValid () && index.column () == 0)
148 menu.addAction (rmgr.
icon (
"edit-copy"), tr (
"Copy"),
this,
150 menu.addAction (tr (
"Evaluate"),
this,
152 menu.addAction (rmgr.
icon (
"document-new"), tr (
"Create script"),
this,
156 menu.addAction (tr (
"Hide filter"),
this,
159 menu.addAction (tr (
"Show filter"),
this,
174 QModelIndexList rows = selectionModel->selectedRows ();
175 bool prev_valid_row =
false;
176 for (
auto it = rows.begin (); it != rows.end (); it++)
178 if ((*it).isValid ())
182 text += (*it).data ().toString ();
183 prev_valid_row =
true;
186 QApplication::clipboard ()->setText (
text);
192 QModelIndexList rows = selectionModel->selectedRows ();
193 for (
auto it = rows.begin () ; it != rows.end (); it++)
195 if ((*it).isValid ())
204 QModelIndexList rows = selectionModel->selectedRows ();
206 bool prev_valid_row =
false;
207 for (
auto it = rows.begin (); it != rows.end (); it++)
209 if ((*it).isValid ())
213 text += (*it).data ().toString ();
214 prev_valid_row =
true;
218 if (
text.length () > 0)
232 if (
m_filter->lineEdit ()->hasFocus ()
233 &&
m_filter->lineEdit ()->hasSelectedText ())
235 QClipboard *clipboard = QApplication::clipboard ();
236 clipboard->setText (
m_filter->lineEdit ()->selectedText ());
242 if (
m_filter->lineEdit ()->hasFocus ())
244 QClipboard *clipboard = QApplication::clipboard ();
245 QString str = clipboard->text ();
246 if (str.length () > 0)
247 m_filter->lineEdit ()->insert (str);
253 if (
m_filter->lineEdit ()->hasFocus ())
254 m_filter->lineEdit ()->selectAll ();
280 (tr (
"Double-click a command to transfer it to the Command Window."));
284 SIGNAL (customContextMenuRequested (
const QPoint &)),
this,
285 SLOT (
ctxMenu (
const QPoint &)));
288 m_filter->setToolTip (tr (
"Enter text to filter the command history"));
291 m_filter->setInsertPolicy (QComboBox::NoInsert);
293 (QComboBox::AdjustToMinimumContentsLengthWithIcon);
294 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
296 m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
298 QLabel *filter_label =
new QLabel (tr (
"Filter"));
302 setWindowIcon (QIcon (
":/actions/icons/logo.png"));
307 QHBoxLayout *filter_layout =
new QHBoxLayout ();
308 filter_layout->addWidget (filter_label);
310 filter_layout->addWidget (
m_filter);
311 filter_layout->setMargin(0);
314 QVBoxLayout *hist_layout =
new QVBoxLayout ();
318 hist_layout->setMargin (2);
319 hist_layout->setSpacing (0);
320 widget ()->setLayout (hist_layout);
338 connect (
m_filter, SIGNAL (editTextChanged (
const QString&)),
340 SLOT (setFilterWildcard (
const QString&)));
343 connect (
m_filter->lineEdit (), SIGNAL (editingFinished (
void)),
354 QFont font = QFont ();
356 font.setStyleHint (QFont::TypeWriter);
Base class for Octave interfaces that use Qt.
resource_manager & get_resource_manager(void)
void append_history(const QString &hist_entry)
void ctxMenu(const QPoint &pos)
QCheckBox * m_filter_checkbox
void set_history(const QStringList &hist)
void pasteClipboard(void)
history_dock_widget(QWidget *parent, base_qobject &oct_qobj)
void handle_contextmenu_create_script(bool flag)
void filter_activate(bool enable)
void notice_settings(const gui_settings *)
void handle_contextmenu_evaluate(bool flag)
void information(const QString &message)
void handle_contextmenu_filter(void)
QListView * m_history_list_view
void command_double_clicked(const QString &command)
Signal emitted whenever the user double-clicks a command in the history.
void command_create_script(const QString &commands)
Signal emitted whenever the user selects commands and chooses "Create script" from the popup menu.
QWidget * m_filter_widget
QStringListModel * m_history_model
Stores the current history_model.
void handle_double_click(QModelIndex modelIndex)
void handle_contextmenu_copy(bool flag)
QSortFilterProxyModel m_sort_filter_proxy_model
virtual void handle_visibility(bool visible)
void update_filter_history(void)
gui_settings * get_settings(void) const
QIcon icon(const QString &icon_name, bool fallback=true)
const gui_pref cs_font_size("terminal/fontSize", QVariant(10))
const gui_pref cs_font("terminal/fontName", QVariant())
const gui_pref global_mono_font("monospace_font", global_font_family)
const gui_pref hw_filter_active("history_dock_widget/filter_active", QVariant(false))
const gui_pref hw_filter_shown("history_dock_widget/filter_shown", QVariant(true))
const gui_pref hw_mru_list("history_dock_widget/mru_list", QVariant())
static uint32_t state[624]