"MainWindow", "&Open...", 0, QApplication::UnicodeUTF8));
action_open->setIcon(QIcon::fromTheme("document-open",
QIcon(":/icons/document-open.png")));
+ action_open->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
action_open->setObjectName(QString::fromUtf8("actionOpen"));
menu_file->addAction(action_open);
"MainWindow", "&Save As...", 0, QApplication::UnicodeUTF8));
action_save_as->setIcon(QIcon::fromTheme("document-save-as",
QIcon(":/icons/document-save-as.png")));
+ action_save_as->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
action_save_as->setObjectName(QString::fromUtf8("actionSaveAs"));
menu_file->addAction(action_save_as);
"MainWindow", "&Decoders", 0, QApplication::UnicodeUTF8));
pv::widgets::DecoderMenu *const menu_decoders_add =
- new pv::widgets::DecoderMenu(menu_decoders);
+ new pv::widgets::DecoderMenu(menu_decoders, true);
menu_decoders_add->setTitle(QApplication::translate(
"MainWindow", "&Add", 0, QApplication::UnicodeUTF8));
connect(menu_decoders_add, SIGNAL(decoder_selected(srd_decoder*)),
// Setup the toolbar
QToolBar *const toolbar = new QToolBar(tr("Main Toolbar"), this);
toolbar->addAction(action_open);
+ toolbar->addAction(action_save_as);
toolbar->addSeparator();
toolbar->addAction(action_view_zoom_in);
toolbar->addAction(action_view_zoom_out);
toolbar->addAction(action_view_zoom_fit);
+ toolbar->addAction(action_view_zoom_one_to_one);
addToolBar(toolbar);
// Setup the sampling bar
Q_ARG(QString, info_text));
}
-void MainWindow::update_device_list(
- shared_ptr<pv::device::DevInst> selected_device)
+void MainWindow::update_device_list()
{
assert(_sampling_bar);
+ shared_ptr<pv::device::DevInst> selected_device = _session.get_device();
list< shared_ptr<device::DevInst> > devices;
std::copy(_device_manager.devices().begin(),
_device_manager.devices().end(), std::back_inserter(devices));
- _sampling_bar->set_device_list(devices);
+ if (std::find(devices.begin(), devices.end(), selected_device) ==
+ devices.end())
+ devices.push_back(selected_device);
+ assert(selected_device);
- if (!selected_device && !devices.empty()) {
- // Fall back to the first device in the list.
- selected_device = devices.front();
-
- // Try and find the demo device and select that by default
- BOOST_FOREACH (shared_ptr<pv::device::DevInst> dev_inst, devices)
- if (strcmp(dev_inst->dev_inst()->driver->name,
- "demo") == 0) {
- selected_device = dev_inst;
- }
- }
-
- if (selected_device) {
- // Setting the selected device in the sampling bar, generates
- // an event which updates the selected device in the SigSession.
- _sampling_bar->set_selected_device(selected_device);
- }
+ _sampling_bar->set_device_list(devices, selected_device);
}
void MainWindow::load_file(QString file_name)
_session.set_file(file_name.toStdString());
} catch(QString e) {
show_session_error(tr("Failed to load ") + file_name, e);
+ _session.set_default_device();
+ update_device_list();
+ return;
}
+ update_device_list();
+
_session.start_capture(boost::bind(&MainWindow::session_error, this,
errorMessage, infoMessage));
}
// If the user selected a device, select it in the device list. Select the
// current device otherwise.
- shared_ptr<device::DevInst> dev_inst = dlg.exec() ?
- dlg.get_selected_device() : _session.get_device();
+ if (dlg.exec())
+ _session.set_device(dlg.get_selected_device());
- update_device_list(dev_inst);
+ update_device_list();
}
void MainWindow::on_actionQuit_triggered()