23 #if defined (HAVE_CONFIG_H) 27 #include <QApplication> 29 #include <QVBoxLayout> 47 setObjectName (
"HistoryDockWidget");
48 setStatusTip (tr (
"Browse and search the command history."));
51 p, SLOT (new_file (
const QString&)));
53 connect (
this, SIGNAL (
information (
const QString&)),
54 p, SLOT (report_status_message (
const QString&)));
57 p, SLOT (execute_command_in_terminal (
const QString&)));
71 lst.append (hist_entry);
75 bool at_bottom = scroll_bar->maximum () - scroll_bar->value () < 1;
96 settings->setValue (
"history_dock_widget/filter_active",
98 settings->setValue (
"history_dock_widget/filter_shown",
m_filter_shown);
103 settings->setValue (
"history_dock_widget/mru_list", mru);
139 if (index.isValid () && index.column () == 0)
143 menu.addAction (tr (
"Evaluate"),
this,
146 tr (
"Create script"),
this,
150 menu.addAction (tr (
"Hide filter"),
this,
153 menu.addAction (tr (
"Show filter"),
this,
168 QModelIndexList rows = selectionModel->selectedRows ();
169 QModelIndexList::iterator it;
170 bool prev_valid_row =
false;
171 for (it = rows.begin (); it != rows.end (); it++)
173 if ((*it).isValid ())
177 text += (*it).data ().toString ();
178 prev_valid_row =
true;
181 QApplication::clipboard ()->setText (
text);
187 QModelIndexList rows = selectionModel->selectedRows ();
188 QModelIndexList::iterator it;
189 for (it = rows.begin () ; it != rows.end (); it++)
191 if ((*it).isValid ())
200 QModelIndexList rows = selectionModel->selectedRows ();
202 bool prev_valid_row =
false;
203 for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++)
205 if ((*it).isValid ())
209 text += (*it).data ().toString ();
210 prev_valid_row =
true;
214 if (
text.length () > 0)
228 if (
m_filter->lineEdit ()->hasFocus ()
229 &&
m_filter->lineEdit ()->hasSelectedText ())
231 QClipboard *clipboard = QApplication::clipboard ();
232 clipboard->setText (
m_filter->lineEdit ()->selectedText ());
238 if (
m_filter->lineEdit ()->hasFocus ())
240 QClipboard *clipboard = QApplication::clipboard ();
241 QString
str = clipboard->text ();
242 if (
str.length () > 0)
249 if (
m_filter->lineEdit ()->hasFocus ())
250 m_filter->lineEdit ()->selectAll ();
276 tr (
"Double-click a command to transfer it to the terminal."));
280 SIGNAL (customContextMenuRequested (
const QPoint &)),
this,
281 SLOT (
ctxMenu (
const QPoint &)));
284 m_filter->setToolTip (tr (
"Enter text to filter the command history"));
287 m_filter->setInsertPolicy (QComboBox::NoInsert);
289 QComboBox::AdjustToMinimumContentsLengthWithIcon);
290 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
292 m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
294 QLabel *filter_label =
new QLabel (tr (
"Filter"));
298 setWindowIcon (QIcon (
":/actions/icons/logo.png"));
303 QHBoxLayout *filter_layout =
new QHBoxLayout ();
304 filter_layout->addWidget (filter_label);
306 filter_layout->addWidget (
m_filter);
307 filter_layout->setMargin(0);
310 QVBoxLayout *hist_layout =
new QVBoxLayout ();
314 hist_layout->setMargin (2);
315 widget ()->setLayout (hist_layout);
321 = settings->value (
"history_dock_widget/filter_shown",
true).toBool ();
325 settings->value (
"history_dock_widget/mru_list").toStringList ());
328 = settings->value (
"history_dock_widget/filter_active",
false).toBool ();
333 connect (
m_filter, SIGNAL (editTextChanged (
const QString&)),
335 SLOT (setFilterWildcard (
const QString&)));
338 connect (
m_filter->lineEdit (), SIGNAL (editingFinished (
void)),
339 this, SLOT (updatem_filter_history (
void)));
void handle_contextmenu_evaluate(bool flag)
void handle_contextmenu_copy(bool flag)
void pasteClipboard(void)
void command_create_script(const QString &commands)
Signale emitted, whenever the user selects commands and chooses "Create script" from the popup menu...
void information(const QString &message)
QCheckBox * m_filter_checkbox
virtual void handle_visibility(bool visible)
void command_double_clicked(const QString &command)
Signal emitted, whenever the user double-clicked a command in the history.
void handle_contextmenu_filter(void)
QSortFilterProxyModel m_sort_filter_proxy_model
history_dock_widget(QWidget *parent=nullptr)
void handle_double_click(QModelIndex modelIndex)
void ctxMenu(const QPoint &pos)
static uint32_t state[624]
void update_filter_history(void)
static QIcon icon(const QString &icon_name, bool fallback=true)
OCTAVE_EXPORT octave_value_list the first data row corresponds to an index of zero The a spreadsheet style form such as the file is read until end of file is reached The such as text
QListView * m_history_list_view
void filter_activate(bool enable)
void set_history(const QStringList &hist)
static QSettings * get_settings(void)
void append_history(const QString &hist_entry)
QStringListModel * m_history_model
Stores the current history_model.
void handle_contextmenu_create_script(bool flag)
QWidget * m_filter_widget