CaptureFilePropertiesDialog::CaptureFilePropertiesDialog(QWidget &parent, CaptureFile &capture_file) : WiresharkDialog(parent, capture_file), ui(new Ui::CaptureFilePropertiesDialog) { ui->setupUi(this); loadGeometry(parent.width() * 2 / 3, parent.height()); ui->detailsTextEdit->setAcceptRichText(true); QPushButton *button = ui->buttonBox->button(QDialogButtonBox::Reset); if (button) { button->setText(tr("Refresh")); } button = ui->buttonBox->button(QDialogButtonBox::Apply); if (button) { button->setText(tr("Copy To Clipboard")); } button = ui->buttonBox->button(QDialogButtonBox::Save); if (button) { button->setText(tr("Save Comments")); } setWindowSubtitle(tr("Capture File Properties")); QTimer::singleShot(0, this, SLOT(updateWidgets())); }
int GraspitDBModel::load(World *w) { // delete the previously loaded graspabody if (mGraspableBody) { delete mGraspableBody; } // load the body mGraspableBody = new GraspableBody(w, ModelName().c_str()); mGraspableBody->setDBModel(this); //material is default mGraspableBody->setMaterial(w->getMaterialIdx("wood")); //PSB objects have a scale of their own. To get to "graspable size" //we manually set a scaling factor for each of them, which is in the //database as well. We need to scale the geometry appropriately SoScale *scale = new SoScale(); scale->scaleFactor.setValue(RescaleFactor(), RescaleFactor(), RescaleFactor()); mGraspableBody->getIVGeomRoot()->addChild(scale); if (loadGeometry() != SUCCESS) { mGeometryLoaded = false; return FAILURE; } mGeometryLoaded = true; mGraspableBody->addIVMat(); //set the dynamic properties. This needs a better solution... mGraspableBody->setDefaultDynamicParameters(); //hard-coded inertia matrix of the flask... double I[] = {4853.0, -1.1196, -6.5156, -1.1196, 4853.0, 47.542, -6.5156, 0.0, 2357.6}; mGraspableBody->setInertiaMatrix(I); mGraspableBody->setMaxRadius(mGraspableBody->computeDefaultMaxRadius()); mGraspableBody->setMass(300); return SUCCESS; }
ResponseTimeDelayDialog::ResponseTimeDelayDialog(QWidget &parent, CaptureFile &cf, register_rtd *rtd, const QString filter, int help_topic) : TapParameterDialog(parent, cf, help_topic), rtd_(rtd) { QString subtitle = tr("%1 Response Time Delay Statistics") .arg(proto_get_protocol_short_name(find_protocol_by_id(get_rtd_proto_id(rtd)))); setWindowSubtitle(subtitle); loadGeometry(0, 0, "ResponseTimeDelayDialog"); QStringList header_names = QStringList() << tr("Type") << tr("Messages") << tr("Min SRT") << tr("Max SRT") << tr("Avg SRT") << tr("Min in Frame") << tr("Max in Frame") << tr("Open Requests") << tr("Discarded Responses") << tr("Repeated Requests") << tr("Repeated Responses"); statsTreeWidget()->setHeaderLabels(header_names); for (int col = 0; col < statsTreeWidget()->columnCount(); col++) { if (col == col_type_) continue; statsTreeWidget()->headerItem()->setTextAlignment(col, Qt::AlignRight); } if (!filter.isEmpty()) { setDisplayFilter(filter); } }
// Constructor. LteRlcGraphDialog::LteRlcGraphDialog(QWidget &parent, CaptureFile &cf, bool channelKnown) : WiresharkDialog(parent, cf), ui(new Ui::LteRlcGraphDialog), mouse_drags_(true), rubber_band_(NULL), base_graph_(NULL), reseg_graph_(NULL), acks_graph_(NULL), nacks_graph_(NULL), tracer_(NULL), packet_num_(0) { ui->setupUi(this); loadGeometry(parent.width() * 4 / 5, parent.height() * 3 / 4); QCustomPlot *rp = ui->rlcPlot; rp->xAxis->setLabel(tr("Time")); rp->yAxis->setLabel(tr("Sequence Number")); // TODO: couldn't work out how to tell rp->xAxis not to label fractions of a SN... ui->dragRadioButton->setChecked(mouse_drags_); ctx_menu_ = new QMenu(this); ctx_menu_->addAction(ui->actionZoomIn); ctx_menu_->addAction(ui->actionZoomInX); ctx_menu_->addAction(ui->actionZoomInY); ctx_menu_->addAction(ui->actionZoomOut); ctx_menu_->addAction(ui->actionZoomOutX); ctx_menu_->addAction(ui->actionZoomOutY); ctx_menu_->addAction(ui->actionReset); ctx_menu_->addSeparator(); ctx_menu_->addAction(ui->actionMoveRight10); ctx_menu_->addAction(ui->actionMoveLeft10); ctx_menu_->addAction(ui->actionMoveUp10); ctx_menu_->addAction(ui->actionMoveUp100); ctx_menu_->addAction(ui->actionMoveDown10); ctx_menu_->addAction(ui->actionMoveDown100); ctx_menu_->addAction(ui->actionMoveRight1); ctx_menu_->addAction(ui->actionMoveLeft1); ctx_menu_->addAction(ui->actionMoveUp1); ctx_menu_->addAction(ui->actionMoveDown1); ctx_menu_->addSeparator(); ctx_menu_->addAction(ui->actionGoToPacket); ctx_menu_->addSeparator(); ctx_menu_->addAction(ui->actionDragZoom); // ctx_menu_->addAction(ui->actionToggleTimeOrigin); ctx_menu_->addAction(ui->actionCrosshairs); ctx_menu_->addSeparator(); ctx_menu_->addAction(ui->actionSwitchDirection); // Zero out this struct. memset(&graph_, 0, sizeof(graph_)); // If channel is known, details will be supplied by setChannelInfo(). if (!channelKnown) { completeGraph(); } }
CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) : GeometryStateDialog(parent), ui(new Ui::CaptureInterfacesDialog) { ui->setupUi(this); loadGeometry(); setWindowTitle(wsApp->windowTitleString(tr("Capture Interfaces"))); stat_timer_ = NULL; stat_cache_ = NULL; // XXX - Enable / disable as needed ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Start")); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled((global_capture_opts.num_selected > 0)? true: false); // Start out with the list *not* sorted, so they show up in the order // in which they were provided ui->interfaceTree->sortByColumn(-1, Qt::AscendingOrder); ui->interfaceTree->setItemDelegateForColumn(col_interface_, &interface_item_delegate_); ui->interfaceTree->setItemDelegateForColumn(col_traffic_, new SparkLineDelegate()); ui->interfaceTree->setItemDelegateForColumn(col_link_, &interface_item_delegate_); ui->interfaceTree->setItemDelegateForColumn(col_snaplen_, &interface_item_delegate_); #ifdef SHOW_BUFFER_COLUMN ui->interfaceTree->setItemDelegateForColumn(col_buffer_, &interface_item_delegate_); #else ui->interfaceTree->setColumnHidden(col_buffer_, true); #endif #ifndef SHOW_MONITOR_COLUMN ui->interfaceTree->setColumnHidden(col_monitor_, true); #endif ui->interfaceTree->setItemDelegateForColumn(col_filter_, &interface_item_delegate_); interface_item_delegate_.setTree(ui->interfaceTree); #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) ui->filenameLineEdit->setPlaceholderText(tr("Leave blank to use a temporary file")); #endif // Changes in interface selections or capture filters should be propagated // to the main welcome screen where they will be applied to the global // capture options. connect(this, SIGNAL(interfacesChanged()), ui->captureFilterComboBox, SIGNAL(interfacesChanged())); connect(ui->captureFilterComboBox, SIGNAL(captureFilterSyntaxChanged(bool)), this, SLOT(updateWidgets())); connect(ui->captureFilterComboBox->lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(filterEdited())); connect(ui->captureFilterComboBox->lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(captureFilterTextEdited(QString))); connect(&interface_item_delegate_, SIGNAL(filterChanged(QString)), ui->captureFilterComboBox->lineEdit(), SLOT(setText(QString))); connect(&interface_item_delegate_, SIGNAL(filterChanged(QString)), this, SIGNAL(captureFilterTextEdited(QString))); connect(this, SIGNAL(ifsChanged()), this, SLOT(refreshInterfaceList())); connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(updateLocalInterfaces())); connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); }
KonvergoWindow::KonvergoWindow(QWindow* parent) : QQuickWindow(parent), m_debugLayer(false), m_lastScale(1.0) { // NSWindowCollectionBehaviorFullScreenPrimary is only set on OSX if Qt::WindowFullscreenButtonHint is set on the window. setFlags(flags() | Qt::WindowFullscreenButtonHint); m_infoTimer = new QTimer(this); m_infoTimer->setInterval(1000); installEventFilter(new EventFilter(this)); connect(m_infoTimer, &QTimer::timeout, this, &KonvergoWindow::updateDebugInfo); InputComponent::Get().registerHostCommand("close", this, "close"); InputComponent::Get().registerHostCommand("toggleDebug", this, "toggleDebug"); InputComponent::Get().registerHostCommand("reload", this, "reloadWeb"); InputComponent::Get().registerHostCommand("fullscreen", this, "toggleFullscreen"); #ifdef TARGET_RPI // On RPI, we use dispmanx layering - the video is on a layer below Konvergo, // and during playback the Konvergo window is partially transparent. The OSD // will be visible on top of the video as part of the Konvergo window. setColor(QColor("transparent")); #else setColor(QColor("#111111")); #endif loadGeometry(); notifyScale(size()); connect(SettingsComponent::Get().getSection(SETTINGS_SECTION_MAIN), &SettingsSection::valuesUpdated, this, &KonvergoWindow::updateMainSectionSettings); connect(this, &KonvergoWindow::visibilityChanged, this, &KonvergoWindow::onVisibilityChanged); connect(this, &KonvergoWindow::enableVideoWindowSignal, this, &KonvergoWindow::enableVideoWindow, Qt::QueuedConnection); connect(&PlayerComponent::Get(), &PlayerComponent::windowVisible, this, &KonvergoWindow::playerWindowVisible); connect(&PlayerComponent::Get(), &PlayerComponent::playbackStarting, this, &KonvergoWindow::playerPlaybackStarting); // this is using old syntax because ... reasons. QQuickCloseEvent is not public class connect(this, SIGNAL(closing(QQuickCloseEvent*)), this, SLOT(closingWindow())); connect(qApp, &QCoreApplication::aboutToQuit, this, &KonvergoWindow::closingWindow); #ifdef KONVERGO_OPENELEC setVisibility(QWindow::FullScreen); #else updateFullscreenState(false); #endif emit enableVideoWindowSignal(); }
void KonvergoWindow::onVisibilityChanged(QWindow::Visibility visibility) { QLOG_DEBUG() << (visibility == QWindow::FullScreen ? "FullScreen" : "Windowed") << "visbility set to " << visibility; if (visibility == QWindow::Windowed) loadGeometry(); if (visibility == QWindow::FullScreen) PowerComponent::Get().setFullscreenState(true); else if (visibility == QWindow::Windowed) PowerComponent::Get().setFullscreenState(false); }
ProfileDialog::ProfileDialog(QWidget *parent) : GeometryStateDialog(parent), pd_ui_(new Ui::ProfileDialog), ok_button_(NULL) { GList *fl_entry; profile_def *profile; const gchar *profile_name = get_profile_name(); pd_ui_->setupUi(this); loadGeometry(); setWindowTitle(wsApp->windowTitleString(tr("Configuration Profiles"))); ok_button_ = pd_ui_->buttonBox->button(QDialogButtonBox::Ok); // XXX - Use NSImageNameAddTemplate and NSImageNameRemoveTemplate to set stock // icons on macOS. // Are there equivalent stock icons on Windows? #ifdef Q_OS_MAC pd_ui_->newToolButton->setAttribute(Qt::WA_MacSmallSize, true); pd_ui_->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true); pd_ui_->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true); pd_ui_->infoLabel->setAttribute(Qt::WA_MacSmallSize, true); #endif init_profile_list(); fl_entry = edited_profile_list(); pd_ui_->profileTreeWidget->blockSignals(true); while (fl_entry && fl_entry->data) { profile = (profile_def *) fl_entry->data; QTreeWidgetItem *item = new QTreeWidgetItem(pd_ui_->profileTreeWidget); item->setText(0, profile->name); item->setData(0, Qt::UserRole, VariantPointer<GList>::asQVariant(fl_entry)); if (profile->is_global || profile->status == PROF_STAT_DEFAULT) { QFont ti_font = item->font(0); ti_font.setItalic(true); item->setFont(0, ti_font); } else { item->setFlags(item->flags() | Qt::ItemIsEditable); } if (!profile->is_global && strcmp(profile_name, profile->name) == 0) { pd_ui_->profileTreeWidget->setCurrentItem(item); } fl_entry = g_list_next(fl_entry); } pd_ui_->profileTreeWidget->blockSignals(false); connect(pd_ui_->profileTreeWidget->itemDelegate(), SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)), this, SLOT(editingFinished())); updateWidgets(); }
MainWindow::MainWindow(Controller *controller, Qt::WindowFlags flags) : KParts::MainWindow(0, flags), d(new MainWindowPrivate(this, controller)) { connect(this, SIGNAL(destroyed()), controller, SLOT(areaReleased())); loadGeometry(KGlobal::config()->group("Main Window")); d->areaSwitcher = new AreaTabWidget(menuBar()); menuBar()->setCornerWidget(d->areaSwitcher, Qt::TopRightCorner); // don't allow AllowTabbedDocks - that doesn't make sense for "ideal" UI setDockOptions(QMainWindow::AnimatedDocks); }
void Shader::init() { initPointers(); loadVertex(); if (d_n_geometry != 0) loadGeometry(); loadFragment(); compile(); link(); }
void StitcherWorkspace::onItemChanged(QStandardItem * item) { if(item->isEnabled() == false) { return; } if(item->flags() & Qt::ItemIsUserCheckable) { bool value = (item->checkState() == Qt::Checked); QString property = item->data(Qt::UserRole + 2).toString(); ImageItem * imageItem = item->data(Qt::UserRole + 3).value<ImageItem *>(); imageItem->setProperty(property.toAscii().constData(),value); loadGeometry(); } else if(item->flags() & Qt::ItemIsEditable) { qDebug("item changed"); if(!item->data().isValid()) { item = item->parent(); } if(!item->data().isValid()) { qFatal("Can't reach here"); } QVariant var = item->data(); if(var.type() == QVariant::Double) { double value = item->text().toDouble(); QString property = item->data(Qt::UserRole + 2).toString(); if(property.endsWith("_theta") || property.endsWith("_alpha")) { /* convert from degrees */ value /= 180/M_PI; } if(property.endsWith("_dy")) { /* swap axis */ value = -value; } ImageItem * imageItem = item->data(Qt::UserRole + 3).value<ImageItem *>(); // item->setText(QString("%0").arg(value)); imageItem->setProperty(property.toAscii().constData(),value); qDebug("New value for %s = %f",property.toAscii().data(),value); loadGeometry(); } } }
PreferencesDialog::PreferencesDialog(QWidget *parent) : GeometryStateDialog(parent), pd_ui_(new Ui::PreferencesDialog), model_(this), advancedPrefsModel_(this), advancedPrefsDelegate_(this), modulePrefsModel_(this) { advancedPrefsModel_.setSourceModel(&model_); modulePrefsModel_.setSourceModel(&model_); saved_capture_no_extcap_ = prefs.capture_no_extcap; // Some classes depend on pref_ptr_to_pref_ so this MUST be called after // model_.populate(). pd_ui_->setupUi(this); loadGeometry(); setWindowTitle(wsApp->windowTitleString(tr("Preferences"))); pd_ui_->advancedView->setModel(&advancedPrefsModel_); pd_ui_->advancedView->setItemDelegate(&advancedPrefsDelegate_); advancedPrefsModel_.setFirstColumnSpanned(pd_ui_->advancedView); pd_ui_->prefsView->setModel(&modulePrefsModel_); pd_ui_->splitter->setStretchFactor(0, 1); pd_ui_->splitter->setStretchFactor(1, 5); pd_ui_->prefsView->sortByColumn(ModulePrefsModel::colName, Qt::AscendingOrder); //Set the Appearance leaf to expanded pd_ui_->prefsView->setExpanded(modulePrefsModel_.index(APPEARANCE_ITEM, 0), true); // PreferencesPane, prefsView, and stackedWidget must all correspond to each other. prefs_pane_to_item_[PrefsModel::APPEARANCE_PREFERENCE_TREE_NAME] = pd_ui_->appearanceFrame; prefs_pane_to_item_[PrefsModel::LAYOUT_PREFERENCE_TREE_NAME] = pd_ui_->layoutFrame; prefs_pane_to_item_[PrefsModel::COLUMNS_PREFERENCE_TREE_NAME] = pd_ui_->columnFrame; prefs_pane_to_item_[PrefsModel::FONT_AND_COLORS_PREFERENCE_TREE_NAME] = pd_ui_->fontandcolorFrame; prefs_pane_to_item_[PrefsModel::CAPTURE_PREFERENCE_TREE_NAME] = pd_ui_->captureFrame; prefs_pane_to_item_[PrefsModel::EXPERT_PREFERENCE_TREE_NAME] = pd_ui_->expertFrame; prefs_pane_to_item_[PrefsModel::FILTER_BUTTONS_PREFERENCE_TREE_NAME] = pd_ui_->filterExpressonsFrame; prefs_pane_to_item_[PrefsModel::ADVANCED_PREFERENCE_TREE_NAME] = pd_ui_->advancedFrame; prefs_pane_to_item_[MODULES_NAME] = NULL; pd_ui_->filterExpressonsFrame->setUat(uat_get_table_by_name("Display expressions")); pd_ui_->expertFrame->setUat(uat_get_table_by_name("Expert Info Severity Level Configuration")); connect(pd_ui_->prefsView, SIGNAL(goToPane(QString)), this, SLOT(selectPane(QString))); }
QTreeView * StitcherWorkspace::createGeometryTree() { /* need a real QTreeView with a model */ QStandardItemModel * model = new QStandardItemModel; QTreeView *treeView = new QTreeView(this); geometryTree = treeView; treeView->setModel(model); loadGeometry(); treeView->setAlternatingRowColors(true); treeView->setSelectionMode(QAbstractItemView::SingleSelection); treeView->setSelectionBehavior(QAbstractItemView::SelectRows); treeView->resizeColumnToContents(0); treeView->resizeColumnToContents(1); connect(model,SIGNAL(itemChanged(QStandardItem * )),this,SLOT(onItemChanged(QStandardItem *))); return treeView; }
StatsTreeDialog::StatsTreeDialog(QWidget &parent, CaptureFile &cf, const char *cfg_abbr) : TapParameterDialog(parent, cf), st_(NULL), st_cfg_(NULL) { loadGeometry(800, height(), cfg_abbr); st_cfg_ = stats_tree_get_cfg_by_abbr(cfg_abbr); memset(&cfg_pr_, 0, sizeof(struct _tree_cfg_pres)); if (!st_cfg_) { QMessageBox::critical(this, tr("Configuration not found"), tr("Unable to find configuration for %1.").arg(cfg_abbr)); QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection); } }
/*! * Reads a mesh stanza from XML. The following elements are supported in addition to the odObject elements: * - filename * - filename for the class to load. At present only ASCII STL is supported. */ void odMesh::readFromXML(QDomNode root){ int i; QDomNode node; QDomElement element; element=root.toElement(); if (element.hasAttribute("reference")) refString=element.attribute("reference"); node=root.firstChild(); while (!node.isNull()){ element=node.toElement(); if (element.tagName().toLower()=="filename") geometryFile=element.text(); node=node.nextSibling(); } loadGeometry(); }
void KonvergoWindow::updateFullscreenState() { if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "fullscreen").toBool() || SystemComponent::Get().isOpenELEC()) { // if we were go from windowed to fullscreen // we want to stor our current windowed position if (!isFullScreen()) saveGeometry(); setVisibility(QWindow::FullScreen); } else { setVisibility(QWindow::Windowed); loadGeometry(); } }
DisplayFilterExpressionDialog::DisplayFilterExpressionDialog(QWidget *parent) : GeometryStateDialog(parent), ui(new Ui::DisplayFilterExpressionDialog), ftype_(FT_NONE), field_(NULL) { ui->setupUi(this); if (parent) loadGeometry(parent->width() * 2 / 3, parent->height()); setAttribute(Qt::WA_DeleteOnClose, true); setWindowTitle(wsApp->windowTitleString(tr("Display Filter Expression"))); setWindowIcon(wsApp->normalIcon()); proto_initialize_all_prefixes(); ui->fieldTreeWidget->setToolTip(ui->fieldLabel->toolTip()); ui->searchLineEdit->setToolTip(ui->searchLabel->toolTip()); ui->relationListWidget->setToolTip(ui->relationLabel->toolTip()); ui->valueLineEdit->setToolTip(ui->valueLabel->toolTip()); ui->enumListWidget->setToolTip(ui->enumLabel->toolTip()); ui->rangeLineEdit->setToolTip(ui->rangeLabel->toolTip()); // Relation list new QListWidgetItem("is present", ui->relationListWidget, present_op_); new QListWidgetItem("==", ui->relationListWidget, eq_op_); new QListWidgetItem("!=", ui->relationListWidget, ne_op_); new QListWidgetItem(">", ui->relationListWidget, gt_op_); new QListWidgetItem("<", ui->relationListWidget, lt_op_); new QListWidgetItem(">=", ui->relationListWidget, ge_op_); new QListWidgetItem("<=", ui->relationListWidget, le_op_); new QListWidgetItem("contains", ui->relationListWidget, contains_op_); new QListWidgetItem("matches", ui->relationListWidget, matches_op_); new QListWidgetItem("in", ui->relationListWidget, in_op_); value_label_pfx_ = ui->valueLabel->text(); connect(ui->valueLineEdit, SIGNAL(textEdited(QString)), this, SLOT(updateWidgets())); connect(ui->rangeLineEdit, SIGNAL(textEdited(QString)), this, SLOT(updateWidgets())); // Trigger updateWidgets ui->fieldTreeWidget->selectionModel()->clear(); QTimer::singleShot(0, this, SLOT(fillTree())); }
HgConfigDialog::HgConfigDialog(HgConfig::ConfigType type, QWidget *parent): KPageDialog(parent), m_configType(type) { // dialog properties if (m_configType == HgConfig::RepoConfig) { this->setWindowTitle(xi18nc("@title:window", "<application>Hg</application> Repository Configuration")); } else { this->setWindowTitle(xi18nc("@title:window", "<application>Hg</application> Global Configuration")); } this->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel); setupUI(); loadGeometry(); connect(this, SIGNAL(finished(int)), this, SLOT(saveGeometry())); }
EnabledProtocolsDialog::EnabledProtocolsDialog(QWidget *parent) : GeometryStateDialog(parent), ui(new Ui::EnabledProtocolsDialog) { ui->setupUi(this); loadGeometry(); setWindowTitle(wsApp->windowTitleString(tr("Enabled Protocols"))); void *cookie; protocol_t *protocol; //Remove "original" item ui->protocol_tree_->takeTopLevelItem(0); // Iterate over all the protocols for (gint i = proto_get_first_protocol(&cookie); i != -1; i = proto_get_next_protocol(&cookie)) { if (proto_can_toggle_protocol(i)) { protocol = find_protocol_by_id(i); ProtocolTreeWidgetItem* protocol_row = new ProtocolTreeWidgetItem(ui->protocol_tree_->invisibleRootItem(), protocol); proto_heuristic_dissector_foreach(protocol, addHeuristicItem, protocol_row); } } ui->protocol_tree_->expandAll(); //make sortable ui->protocol_tree_->setSortingEnabled(true); ui->protocol_tree_->sortByColumn(PROTOCOL_COLUMN, Qt::AscendingOrder); // Some protocols have excessively long names. Instead of calling // resizeColumnToContents, pick a reasonable-ish em width and apply it. int one_em = ui->protocol_tree_->fontMetrics().height(); ui->protocol_tree_->setColumnWidth(PROTOCOL_COLUMN, one_em * 18); //"Remove" Save button if (!prefs.gui_use_pref_save) ui->buttonBox->button(QDialogButtonBox::Save)->setHidden(true); }
ConversationHashTablesDialog::ConversationHashTablesDialog(QWidget *parent) : GeometryStateDialog(parent), ui(new Ui::ConversationHashTablesDialog) { ui->setupUi(this); if (parent) loadGeometry(parent->width() * 3 / 4, parent->height() * 3 / 4); setWindowTitle(wsApp->windowTitleString(tr("Dissector Tables"))); QString html; html += "<h3>Conversation Hash Tables</h3>\n"; html += hashTableToHtmlTable("conversation_hashtable_exact", get_conversation_hashtable_exact()); html += hashTableToHtmlTable("conversation_hashtable_no_addr2", get_conversation_hashtable_no_addr2()); html += hashTableToHtmlTable("conversation_hashtable_no_port2", get_conversation_hashtable_no_port2()); html += hashTableToHtmlTable("conversation_hashtable_no_addr2_or_port2", get_conversation_hashtable_no_addr2_or_port2()); ui->conversationTextEdit->setHtml(html); }
void StitcherWorkspace::onLoadGeometryClicked() { QString file = QFileDialog::getOpenFileName(0,tr("Load Geometry from File"), QString(), tr("Image Geometry (*.hig)")); if(file.isEmpty()) { return; } QFile fp(file); if(!fp.open(QIODevice::ReadOnly)) { return; } QList<QGraphicsItem *> graphicsItems = _stitcherView->items(); QTextStream in(&fp); QString dumb; int nImages; in >> dumb >> dumb >> nImages; for(int i = 0; i<nImages; i++) { QString id; double dx,dy,dz,theta; in >> dumb >> id; ImageItem * item = NULL; for(int j = 0; j < graphicsItems.size(); j++) { item = qgraphicsitem_cast<ImageItem *>(graphicsItems[j]); if(item && item->identifier() == id) { break; } else { item = NULL; } } in >> dumb >> dx; in >> dumb >> dy; in >> dumb >> dz; in >> dumb >> theta; if(item) { item->setDx(dx); item->setDy(dy); item->setDz(dz); item->setTheta(theta); } } fp.close(); loadGeometry(); }
EnabledProtocolsDialog::EnabledProtocolsDialog(QWidget *parent) : GeometryStateDialog(parent), ui(new Ui::EnabledProtocolsDialog), enabled_protocols_model_(new EnabledProtocolsModel()), proxyModel_(new EnabledProtocolsProxyModel(this)) { ui->setupUi(this); loadGeometry(); proxyModel_->setSourceModel(enabled_protocols_model_); ui->protocol_tree_->setModel(proxyModel_); setWindowTitle(wsApp->windowTitleString(tr("Enabled Protocols"))); // Some protocols have excessively long names. Instead of calling // resizeColumnToContents, pick a reasonable-ish em width and apply it. int one_em = ui->protocol_tree_->fontMetrics().height(); ui->protocol_tree_->setColumnWidth(EnabledProtocolsModel::colProtocol, one_em * 18); QTimer::singleShot(0, this, SLOT(fillTree())); }
ColoringRulesDialog::ColoringRulesDialog(QWidget *parent, QString add_filter) : GeometryStateDialog(parent), ui(new Ui::ColoringRulesDialog), conversation_colors_(NULL) { ui->setupUi(this); if (parent) loadGeometry(parent->width() * 2 / 3, parent->height() * 4 / 5); setWindowTitle(wsApp->windowTitleString(QStringList() << tr("Coloring Rules") << get_profile_name())); ui->coloringRulesTreeWidget->setDragEnabled(true); ui->coloringRulesTreeWidget->viewport()->setAcceptDrops(true); ui->coloringRulesTreeWidget->setDropIndicatorShown(true); ui->coloringRulesTreeWidget->setDragDropMode(QAbstractItemView::InternalMove); color_filters_clone(this, color_filter_add_cb); for (int i = 0; i < ui->coloringRulesTreeWidget->columnCount(); i++) { ui->coloringRulesTreeWidget->setItemDelegateForColumn(i, &coloring_rules_tree_delegate_); ui->coloringRulesTreeWidget->resizeColumnToContents(i); } coloring_rules_tree_delegate_.setTree(ui->coloringRulesTreeWidget); if (!add_filter.isEmpty()) { addColoringRule(false, new_rule_name_, add_filter, palette().color(QPalette::Text), palette().color(QPalette::Base), true); } connect(ui->coloringRulesTreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(updateWidgets())); import_button_ = ui->buttonBox->addButton(tr("Import" UTF8_HORIZONTAL_ELLIPSIS), QDialogButtonBox::ApplyRole); import_button_->setToolTip(tr("Select a file and add its filters to the end of the list.")); export_button_ = ui->buttonBox->addButton(tr("Export" UTF8_HORIZONTAL_ELLIPSIS), QDialogButtonBox::ApplyRole); export_button_->setToolTip(tr("Save filters in a file.")); updateWidgets(); }
BluetoothDevicesDialog::BluetoothDevicesDialog(QWidget &parent, CaptureFile &cf, PacketList *packet_list) : WiresharkDialog(parent, cf), ui(new Ui::BluetoothDevicesDialog) { ui->setupUi(this); loadGeometry(parent.width() * 4 / 5, parent.height() * 2 / 3); packet_list_ = packet_list; connect(ui->tableTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(tableContextMenu(const QPoint &))); connect(ui->tableTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(tableItemDoubleClicked(QTreeWidgetItem *, int))); connect(ui->interfaceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(interfaceCurrentIndexChanged(int))); connect(ui->showInformationStepsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showInformationStepsChanged(int))); ui->tableTreeWidget->sortByColumn(column_number_bd_addr, Qt::AscendingOrder); ui->tableTreeWidget->setStyleSheet("QTreeView::item:hover{background-color:lightyellow; color:black;}"); context_menu_.addActions(QList<QAction *>() << ui->actionMark_Unmark_Cell); context_menu_.addActions(QList<QAction *>() << ui->actionMark_Unmark_Row); context_menu_.addActions(QList<QAction *>() << ui->actionCopy_Cell); context_menu_.addActions(QList<QAction *>() << ui->actionCopy_Rows); context_menu_.addActions(QList<QAction *>() << ui->actionCopy_All); context_menu_.addActions(QList<QAction *>() << ui->actionSave_as_image); tapinfo_.tap_packet = tapPacket; tapinfo_.tap_reset = tapReset; tapinfo_.ui = this; registerTapListener("bluetooth.device", &tapinfo_, NULL, 0, bluetooth_device_tap_reset, bluetooth_device_tap_packet, NULL ); ui->hintLabel->setText(ui->hintLabel->text().arg(0)); cap_file_.retapPackets(); }
ExpertInfoDialog::ExpertInfoDialog(QWidget &parent, CaptureFile &capture_file) : WiresharkDialog(parent, capture_file), ui(new Ui::ExpertInfoDialog), expert_info_model_(new ExpertInfoModel(capture_file)), proxyModel_(new ExpertInfoProxyModel(this)), display_filter_(QString()) { ui->setupUi(this); proxyModel_->setSourceModel(expert_info_model_); ui->expertInfoTreeView->setModel(proxyModel_); setWindowSubtitle(tr("Expert Information")); // Clicking on an item jumps to its associated packet. Make the dialog // narrow so that we avoid obscuring the packet list. int dlg_width = parent.width() * 3 / 5; if (dlg_width < width()) dlg_width = width(); loadGeometry(dlg_width, parent.height()); int one_em = fontMetrics().height(); ui->expertInfoTreeView->setColumnWidth(ExpertInfoProxyModel::colProxySummary, one_em * 25); // Arbitrary //Unfortunately this has to be done manually and not through .ui ui->severitiesPushButton->setMenu(ui->menuShowExpert); ui->expertInfoTreeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->expertInfoTreeView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showExpertInfoMenu(QPoint))); QMenu *submenu; FilterAction::Action cur_action = FilterAction::ActionApply; submenu = ctx_menu_.addMenu(FilterAction::actionName(cur_action)); foreach (FilterAction::ActionType at, FilterAction::actionTypes()) { FilterAction *fa = new FilterAction(submenu, cur_action, at); submenu->addAction(fa); connect(fa, SIGNAL(triggered()), this, SLOT(filterActionTriggered())); }
UatDialog::UatDialog(QWidget *parent, epan_uat *uat) : GeometryStateDialog(parent), ui(new Ui::UatDialog), uat_model_(NULL), uat_delegate_(NULL), uat_(NULL) { ui->setupUi(this); if (uat) loadGeometry(0, 0, uat->name); ui->deleteToolButton->setEnabled(false); ui->copyToolButton->setEnabled(false); ok_button_ = ui->buttonBox->button(QDialogButtonBox::Ok); help_button_ = ui->buttonBox->button(QDialogButtonBox::Help); #ifdef Q_OS_MAC ui->newToolButton->setAttribute(Qt::WA_MacSmallSize, true); ui->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true); ui->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true); ui->pathLabel->setAttribute(Qt::WA_MacSmallSize, true); #endif setUat(uat); // FIXME: this prevents the columns from being resized, even if the text // within a combobox needs more space (e.g. in the USER DLT settings). For // very long filenames in the SSL RSA keys dialog, it also results in a // vertical scrollbar. Maybe remove this since the editor is not limited to // the column width (and overlays other fields if more width is needed)? #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) ui->uatTreeView->header()->setResizeMode(QHeaderView::ResizeToContents); #else ui->uatTreeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); #endif // Need to add uat_move or uat_insert to the UAT API. ui->uatTreeView->setDragEnabled(false); qDebug() << "FIX Add drag reordering to UAT dialog"; }
bool loadConfig(const QString& filename, QMainWindow *mainWindow) { // Load Existing Configuration ///////////////////////////////////////////// QFile file(filename); if( !file.open(QFile::ReadOnly) ) { return false; } QJsonParseError error; const QJsonDocument cfgDoc = QJsonDocument::fromJson(file.readAll(), &error); file.close(); if( error.error != QJsonParseError::NoError ) { return false; } const QJsonObject cfgObj = cfgDoc.object(); if( cfgObj.isEmpty() ) { return false; } // WMainWindow ///////////////////////////////////////////////////////////// const QJsonObject mainObj = cfgObj[QStringLiteral("mainWindow")].toObject(); if( !mainObj.isEmpty() ) { loadGeometry(mainWindow, mainObj); } // WPlotWindow ///////////////////////////////////////////////////////////// WPlotWindow::loadConfig(cfgObj); // WValuesWindow /////////////////////////////////////////////////////////// WValuesWindow::loadConfig(cfgObj); return true; }
ProtocolHierarchyDialog::ProtocolHierarchyDialog(QWidget &parent, CaptureFile &cf) : WiresharkDialog(parent, cf), ui(new Ui::ProtocolHierarchyDialog) { ui->setupUi(this); loadGeometry(parent.width() * 4 / 5, parent.height() * 4 / 5); setWindowSubtitle(tr("Protocol Hierarchy Statistics")); ui->hierStatsTreeWidget->setItemDelegateForColumn(pct_packets_col_, &percent_bar_delegate_); ui->hierStatsTreeWidget->setItemDelegateForColumn(pct_bytes_col_, &percent_bar_delegate_); ph_stats_t *ph_stats = ph_stats_new(cap_file_.capFile()); if (ph_stats) { ui->hierStatsTreeWidget->invisibleRootItem()->setData(0, Qt::UserRole, VariantPointer<ph_stats_t>::asQVariant(ph_stats)); g_node_children_foreach(ph_stats->stats_tree, G_TRAVERSE_ALL, addTreeNode, ui->hierStatsTreeWidget->invisibleRootItem()); ph_stats_free(ph_stats); } ui->hierStatsTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->hierStatsTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showProtoHierMenu(QPoint))); ui->hierStatsTreeWidget->setSortingEnabled(true); ui->hierStatsTreeWidget->expandAll(); for (int i = 0; i < ui->hierStatsTreeWidget->columnCount(); i++) { ui->hierStatsTreeWidget->resizeColumnToContents(i); } QMenu *submenu; FilterAction::Action cur_action = FilterAction::ActionApply; submenu = ctx_menu_.addMenu(FilterAction::actionName(cur_action)); foreach (FilterAction::ActionType at, FilterAction::actionTypes()) { FilterAction *fa = new FilterAction(submenu, cur_action, at); submenu->addAction(fa); connect(fa, SIGNAL(triggered()), this, SLOT(filterActionTriggered())); }
// Constructor. LteMacStatisticsDialog::LteMacStatisticsDialog(QWidget &parent, CaptureFile &cf, const char *filter) : TapParameterDialog(parent, cf, HELP_STATS_LTE_MAC_TRAFFIC_DIALOG), commonStatsCurrent_(false) { setWindowSubtitle(tr("LTE Mac Statistics")); loadGeometry(parent.width() * 1, parent.height() * 3 / 4, "LTEMacStatisticsDialog"); clearCommonStats(); // Create common_stats_grid to appear just above the filter area. int statstree_layout_idx = verticalLayout()->indexOf(filterLayout()->widget()); QGridLayout *common_stats_grid = new QGridLayout(); // Insert into the vertical layout verticalLayout()->insertLayout(statstree_layout_idx, common_stats_grid); int one_em = fontMetrics().height(); common_stats_grid->setColumnMinimumWidth(2, one_em * 2); common_stats_grid->setColumnStretch(2, 1); common_stats_grid->setColumnMinimumWidth(5, one_em * 2); common_stats_grid->setColumnStretch(5, 1); // Create statistics label. commonStatsLabel_ = new QLabel(this); commonStatsLabel_->setObjectName("statisticsLabel"); commonStatsLabel_->setTextFormat(Qt::RichText); commonStatsLabel_->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse); common_stats_grid->addWidget(commonStatsLabel_); // Create a grid for filtering-related widgetsto also appear in layout. int filter_controls_layout_idx = verticalLayout()->indexOf(filterLayout()->widget()); QGridLayout *filter_controls_grid = new QGridLayout(); // Insert into the vertical layout verticalLayout()->insertLayout(filter_controls_layout_idx, filter_controls_grid); filter_controls_grid->setColumnMinimumWidth(2, one_em * 2); filter_controls_grid->setColumnStretch(2, 1); filter_controls_grid->setColumnMinimumWidth(5, one_em * 2); filter_controls_grid->setColumnStretch(5, 1); // Add individual controls into the grid showSRFilterCheckBox_ = new QCheckBox(tr("Include SR frames in filter")); filter_controls_grid->addWidget(showSRFilterCheckBox_); showRACHFilterCheckBox_ = new QCheckBox(tr("Include RACH frames in filter")); filter_controls_grid->addWidget(showRACHFilterCheckBox_); // Will set whole-UE headings originally. updateHeaderLabels(); statsTreeWidget()->setItemDelegateForColumn(col_ul_padding_percent_, new PercentBarDelegate()); statsTreeWidget()->setItemDelegateForColumn(col_dl_padding_percent_, new PercentBarDelegate()); statsTreeWidget()->sortByColumn(col_rnti_, Qt::AscendingOrder); // Set up column widths. // resizeColumnToContents doesn't work well here, so set sizes manually. for (int col = 0; col < statsTreeWidget()->columnCount() - 1; col++) { switch (col) { case col_rnti_: statsTreeWidget()->setColumnWidth(col, one_em * 8); break; case col_ul_frames_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_ul_bytes_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_ul_mb_s_: statsTreeWidget()->setColumnWidth(col, one_em * 4); break; case col_ul_padding_percent_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_ul_retx_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_dl_frames_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_dl_bytes_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_dl_mb_s_: statsTreeWidget()->setColumnWidth(col, one_em * 4); break; case col_dl_padding_percent_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_dl_crc_failed_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_dl_retx_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; default: // The rest are numeric statsTreeWidget()->setColumnWidth(col, one_em * 4); statsTreeWidget()->headerItem()->setTextAlignment(col, Qt::AlignRight); break; } } addFilterActions(); if (filter) { setDisplayFilter(filter); } // Set handler for when the tree item changes to set the appropriate labels. connect(statsTreeWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(updateHeaderLabels())); // Set handler for when display filter string is changed. connect(this, SIGNAL(updateFilter(QString)), this, SLOT(filterUpdated(QString))); }
int main( int argc, char *argv[] ) { struct application *ap; int c; int verbose = 0; int i, j; int grid_size = 64; fastf_t cell_size; vect_t model_size; vect_t xdir, zdir; int job_count=0; char **result_map = NULL; struct bu_ptbl objs; int my_session_id; int do_plot=0; struct timeval startTime; struct timeval endTime; double diff; point_t mdl_min; point_t mdl_max; struct bu_vlb *vlb; /* Things like bu_malloc() must have these initialized for use with parallel processing */ bu_semaphore_init( RT_SEM_LAST ); /* initialize the list of BRL-CAD objects to be raytraced (this is used for the "-o" option) */ bu_ptbl_init( &objs, 64, "objects" ); /* process command line args */ while ( (c=bu_getopt( argc, argv, "vps:o:" ) ) != -1 ) { switch ( c ) { case 'p': /* do print plot */ do_plot = 1; break; case 's': /* set the grid size (default is 64x64) */ grid_size = atoi( bu_optarg ); break; case 'v': /* turn on verbose logging */ verbose = 1; rts_set_verbosity( 1 ); break; case 'o': /* add an object name to the list of BRL-CAD objects to raytrace */ bu_ptbl_ins( &objs, (long *)bu_optarg ); break; default: /* ERROR */ bu_exit(1, usage, argv[0]); } } if (bu_debug & BU_DEBUG_MEM_CHECK) { bu_prmem("initial memory map"); bu_mem_barriercheck(); } /* shoot a ray ten times, cleaning and loading geometry each time */ for(i=0 ; i<10 ; i++) { /* load geometry */ my_session_id = loadGeometry( argv[bu_optind], &objs ); if ( my_session_id < 0 ) { bu_exit(2, "Failed to load geometry from file (%s)\n", argv[bu_optind] ); } get_model_extents( my_session_id, mdl_min, mdl_max ); VSET( xdir, 1, 0, 0 ); VSET( zdir, 0, 0, 1 ); VSUB2( model_size, mdl_max, mdl_min ); ap = NULL; getApplication(&ap); VJOIN2( ap->a_ray.r_pt, mdl_min, model_size[Z]/2.0, zdir, model_size[X]/2.0, xdir ); VSET( ap->a_ray.r_dir, 0, 1, 0 ); rts_shootray(ap); vlb = (struct bu_vlb*)ap->a_uptr; printHits(vlb); freeApplication(ap); /*rts_clean( my_session_id );*/ bu_log( "\n\n********* %d\n", i); if (bu_debug & BU_DEBUG_MEM_CHECK) { bu_prmem("memory after shutdown"); } } my_session_id = loadGeometry( argv[bu_optind], &objs ); /* submit some jobs */ fprintf( stderr, "\nfiring a grid (%dx%d) of rays at", grid_size, grid_size ); for ( i=0; i<(int)BU_PTBL_LEN( &objs ); i++ ) { fprintf( stderr, " %s", (char *)BU_PTBL_GET( &objs, i ) ); } fprintf( stderr, "...\n" ); if( do_plot ) { result_map = (char **)bu_calloc( grid_size, sizeof( char *), "result_map" ); for ( i=0; i<grid_size; i++ ) { result_map[i] = (char *)bu_calloc( (grid_size+1), sizeof( char ), "result_map[i]" ); } } cell_size = model_size[X] / grid_size; gettimeofday( &startTime, NULL ); for ( i=0; i<grid_size; i++ ) { if( verbose ) { fprintf( stderr, "shooting row %d\n", i ); } for ( j=0; j<grid_size; j++ ) { int hitCount; getApplication(&ap); ap->a_user = my_session_id; VJOIN2( ap->a_ray.r_pt, mdl_min, i*cell_size, zdir, j*cell_size, xdir ); ap->a_ray.index = ap->a_user; VSET( ap->a_ray.r_dir, 0, 1, 0 ); rts_shootray(ap); if( do_plot ) { hitCount = countHits(ap->a_uptr); if ( hitCount == 0 ) { result_map[i][j] = ' '; } else if ( hitCount <= 9 ) { result_map[i][j] = '0' + hitCount; } else { result_map[i][j] = '*'; } } freeApplication(ap); job_count++; } } gettimeofday( &endTime, NULL ); diff = endTime.tv_sec - startTime.tv_sec + (endTime.tv_usec - startTime.tv_usec) / 1000000.0; fprintf( stderr, "time for %d individual rays: %g second\n", job_count, diff ); if(do_plot) { for ( i=grid_size-1; i>=0; i-- ) { fprintf( stderr, "%s\n", result_map[i] ); } } return 0; }