23 #if defined (HAVE_CONFIG_H)
27 #include <QApplication>
29 #include <QVBoxLayout>
32 #include <QDesktopWidget>
46 setObjectName (
"HistoryDockWidget");
47 setStatusTip (tr (
"Browse and search the command history."));
50 p, SLOT (new_file (
const QString&)));
52 connect (
this, SIGNAL (
information (
const QString&)),
53 p, SLOT (report_status_message (
const QString&)));
56 p, SLOT (execute_command_in_terminal (
const QString&)));
71 tr (
"Double-click a command to transfer it to the terminal."));
75 SIGNAL (customContextMenuRequested (
const QPoint &)),
this,
76 SLOT (
ctxMenu (
const QPoint &)));
79 _filter->setToolTip (tr (
"Enter text to filter the command history"));
82 _filter->setInsertPolicy (QComboBox::NoInsert);
84 QComboBox::AdjustToMinimumContentsLengthWithIcon);
85 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
86 _filter->setSizePolicy (sizePol);
87 _filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
89 QLabel *filter_label =
new QLabel (tr (
"Filter"));
93 setWindowIcon (QIcon (
":/actions/icons/logo.png"));
98 QHBoxLayout *filter_layout =
new QHBoxLayout ();
99 filter_layout->addWidget (filter_label);
101 filter_layout->addWidget (
_filter);
102 filter_layout->setMargin(0);
105 QVBoxLayout *hist_layout =
new QVBoxLayout ();
109 hist_layout->setMargin (2);
110 widget ()->setLayout (hist_layout);
116 = settings->value (
"history_dock_widget/filter_shown",
true).toBool();
119 _filter->addItems (settings->value (
"history_dock_widget/mru_list").toStringList ());
122 = settings->value (
"history_dock_widget/filter_active",
false).toBool ();
127 connect (
_filter, SIGNAL (editTextChanged (
const QString&)),
129 SLOT (setFilterWildcard (
const QString&)));
132 connect (
_filter->lineEdit (), SIGNAL (editingFinished ()),
139 QSize screen = QDesktopWidget ().screenGeometry ().size ();
140 int w = screen.width ();
142 int h = fm.height ();
155 settings->setValue (
"history_dock_widget/filter_active",
157 settings->setValue (
"history_dock_widget/filter_shown",
_filter_shown);
162 settings->setValue (
"history_dock_widget/mru_list", mru);
185 int index =
_filter->findText (text);
200 if (index.isValid () && index.column () == 0)
204 menu.addAction (tr (
"Evaluate"),
this,
207 tr (
"Create script"),
this,
211 menu.addAction (tr (
"Hide filter"),
this,
214 menu.addAction (tr (
"Show filter"),
this,
224 QModelIndexList rows = selectionModel->selectedRows ();
225 QModelIndexList::iterator it;
226 bool prev_valid_row =
false;
227 for (it = rows.begin (); it != rows.end (); it++)
229 if ((*it).isValid ())
233 text += (*it).data ().toString ();
234 prev_valid_row =
true;
237 QApplication::clipboard ()->setText (text);
243 QModelIndexList rows = selectionModel->selectedRows ();
244 QModelIndexList::iterator it;
245 for (it = rows.begin () ; it != rows.end (); it++)
247 if ((*it).isValid ())
257 QModelIndexList rows = selectionModel->selectedRows ();
259 bool prev_valid_row =
false;
260 for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++)
262 if ((*it).isValid ())
266 text += (*it).data ().toString ();
267 prev_valid_row =
true;
271 if (text.length () > 0)
299 lst.append (hist_entry);
303 bool at_bottom = scroll_bar->maximum () - scroll_bar->value () < 1;
323 if (
_filter->lineEdit ()->hasFocus ()
324 &&
_filter->lineEdit ()->hasSelectedText ())
326 QClipboard *clipboard = QApplication::clipboard ();
327 clipboard->setText (
_filter->lineEdit ()->selectedText ());
334 if (
_filter->lineEdit ()->hasFocus ())
336 QClipboard *clipboard = QApplication::clipboard ();
337 QString
str = clipboard->text ();
338 if (str.length () > 0)
339 _filter->lineEdit ()->insert (str);
346 if (
_filter->lineEdit ()->hasFocus ())
348 _filter->lineEdit ()->selectAll ();
void update_filter_history()
QStringListModel * _history_model
Stores the current history_model.
void set_history(const QStringList &hist)
history_dock_widget(QWidget *parent=0)
void ctxMenu(const QPoint &pos)
void handle_double_click(QModelIndex modelIndex)
virtual void handle_visibility(bool visible)
QListView * _history_list_view
void information(const QString &message)
std::complex< double > w(std::complex< double > z, double relerr=0)
void handle_contextmenu_copy(bool flag)
static QSettings * get_settings(void)
void command_double_clicked(const QString &command)
Emitted, whenever the user double-clicked a command in the history.
void command_create_script(const QString &commands)
Emitted whenever the user selects command and chooses Create script from popupmenu.
void append_history(const QString &hist_entry)
static uint32_t state[624]
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
=val(i)}if ode{val(i)}occurs in table i
void filter_activate(bool enable)
void handle_contextmenu_filter(void)
QCheckBox * _filter_checkbox
static QIcon icon(const QString &icon_name, bool fallback=true)
void handle_contextmenu_create_script(bool flag)
QSortFilterProxyModel _sort_filter_proxy_model
void handle_contextmenu_evaluate(bool flag)