예제 #1
0
InterfaceTree::InterfaceTree(QWidget *parent) :
    QTreeWidget(parent)
#ifdef HAVE_LIBPCAP
    ,stat_cache_(NULL)
    ,stat_timer_(NULL)
#endif // HAVE_LIBPCAP
{
    QTreeWidgetItem *ti;

    qRegisterMetaType< PointList >( "PointList" );

    header()->setVisible(false);
    setRootIsDecorated(false);
    setUniformRowHeights(true);
    /* Seems to have no effect, still the default value (2) is being used, as it
     * was set in the .ui file. But better safe, then sorry. */
    resetColumnCount();
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setAccessibleName(tr("Welcome screen list"));

    setItemDelegateForColumn(IFTREE_COL_STATS, new SparkLineDelegate(this));
    setDisabled(true);

    ti = new QTreeWidgetItem();
    ti->setText(IFTREE_COL_NAME, tr("Waiting for startup%1").arg(UTF8_HORIZONTAL_ELLIPSIS));
    addTopLevelItem(ti);
    resizeColumnToContents(IFTREE_COL_NAME);

    connect(wsApp, SIGNAL(appInitialized()), this, SLOT(getInterfaceList()));
    connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(interfaceListChanged()));
    connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelectedInterfaces()));
}
예제 #2
0
StageListView::StageListView(QWidget* parent)
:	QTableView(parent),
	m_sizeHint(QTableView::sizeHint()),
	m_pModel(0),
	m_pFirstColDelegate(new LeftColDelegate(this)),
	m_pSecondColDelegate(new RightColDelegate(this)),
	m_curBatchAnimationFrame(0),
	m_timerId(0),
	m_batchProcessingPossible(false),
	m_batchProcessingInProgress(false)
{
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	
	// Prevent current item visualization. Not to be confused
	// with selected items.
	m_pFirstColDelegate->flagsForceDisabled(QStyle::State_HasFocus);
	m_pSecondColDelegate->flagsForceDisabled(QStyle::State_HasFocus);
	setItemDelegateForColumn(0, m_pFirstColDelegate);
	setItemDelegateForColumn(1, m_pSecondColDelegate);
	
	QHeaderView* h_header = horizontalHeader();
	h_header->setResizeMode(QHeaderView::Stretch);
	h_header->hide();
	
	QHeaderView* v_header = verticalHeader();
	v_header->setResizeMode(QHeaderView::ResizeToContents);
	v_header->setMovable(false);
	
	m_pLaunchBtn = new SkinnedButton(
		":/icons/play-small.png",
		":/icons/play-small-hovered.png",
		":/icons/play-small-pressed.png",
		viewport()
	);
	m_pLaunchBtn->setStatusTip(tr("Launch batch processing"));
	m_pLaunchBtn->hide();
	
	connect(
		m_pLaunchBtn, SIGNAL(clicked()),
		this, SIGNAL(launchBatchProcessing())
	);
	
	connect(
		verticalScrollBar(), SIGNAL(rangeChanged(int, int)),
		this, SLOT(ensureSelectedRowVisible()), Qt::QueuedConnection
	);
}
void PluginsView::configureColumns()
{
    ButtonDelegate *btnsDelegate = new ButtonDelegate();
    setItemDelegateForColumn(2, btnsDelegate);
    setItemDelegateForColumn(3, btnsDelegate);

#if QT_VERSION >= 0x050000
    horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
    horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
    horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
    horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
#else
    horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
    horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
    horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents);
    horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents);
#endif
}
예제 #4
0
QmlJSPropertyInspector::QmlJSPropertyInspector(QWidget *parent)
    : Utils::BaseTreeView(parent)
{
    setItemDelegateForColumn(PROPERTY_VALUE_COLUMN, new PropertyEditDelegate(this));

    setModel(&m_model);
    //Add an empty Row to make the headers visible!
    addRow(QString(), QString(), QString(), -1, false);
}
MapFileViewer::MapFileViewer(QWidget *parent) : QTreeView(parent)
{
    setAlternatingRowColors(true);
    setEditTriggers(QTreeView::NoEditTriggers);
    setItemDelegateForColumn(MapViewModel::PERCENT_COLUMN, new BarItemDelegate(this));
    auto adjust = [this](const QModelIndex&) { header()->resizeSections(QHeaderView::ResizeToContents); };
    QObject::connect(this, &QTreeView::expanded, adjust);
    QObject::connect(this, &QTreeView::collapsed, adjust);
}
예제 #6
0
void ParameterTable::initTable()
{
  setRowCount(0);
  setSelectionMode(QTableWidget::NoSelection);

  mpComboDelegate = new CQComboDelegate(NULL, this);
  setItemDelegateForColumn(2, mpComboDelegate);

  setShowGrid(false);
}
예제 #7
0
ArgsTableView::ArgsTableView(QWidget *parent) : QTableView(parent)
{
  QStringList types;
  for (int i = 0; i < sizeof sTypes / sizeof *sTypes; ++i)
    types << *(sTypes + i);

  setItemDelegateForColumn(
      0, new ComboBoxDelegate(types, ComboBoxDelegate::Editable));

  setEditTriggers(QAbstractItemView::AllEditTriggers);
  horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
}
예제 #8
0
HashTypeWidget::HashTypeWidget(QWidget* parent) : QTableView(parent), model_(nullptr) {
  model_ = new HashTableModel(this);
  setModel(model_);

  ActionDelegate* del = new ActionDelegate(this);
  VERIFY(connect(del, &ActionDelegate::addClicked, this, &HashTypeWidget::addRow));
  VERIFY(connect(del, &ActionDelegate::removeClicked, this, &HashTypeWidget::removeRow));

  setItemDelegateForColumn(KeyValueTableItem::kAction, del);
  setContextMenuPolicy(Qt::ActionsContextMenu);
  setSelectionBehavior(QAbstractItemView::SelectRows);
}
예제 #9
0
PropertyBrowser::PropertyBrowser(
    PropertyGroup * root,
    QWidget * parent)
:   QTreeView(parent)
,   m_delegate{new PropertyDelegate{this}}
,   m_alwaysExpandGroups{false}
{
    setRoot(root);
    setItemDelegateForColumn(1, m_delegate);
    
    initView();
}
예제 #10
0
//-------------------------------------------------------------------------------------------------
BachKeywordView::BachKeywordView( QWidget * parent )
:	RecordTreeView( parent )
,	m_MouseIn( false )
,	m_ShowAll( true )
,	m_CallbacksEnabled( false )
{
	mKeywordsModel = new RecordSuperModel( this );
	new BachKeywordTranslator( mKeywordsModel->treeBuilder() );
	mKeywordsModel->setHeaderLabels(QStringList() << "name");
	setModel( mKeywordsModel );
	setItemDelegateForColumn( Column_Has, new KeywordDelegate( this ) );
	setItemDelegateForColumn( Column_Name, new KeywordDelegate( this ) );
	// TODO: why is it "name" aswell?
	// setItemDelegateForColumn( Column_Name, new KeywordDelegate( this ) );

	connect( this, SIGNAL( clicked( const QModelIndex & ) ), SLOT( onClicked( const QModelIndex & ) ) );
	enableCallbacks();

    setSelectionMode( QAbstractItemView::SingleSelection );
    mKeywordsModel->sort(Column_Name, Qt::AscendingOrder);
    header()->setSortIndicator(Column_Name, Qt::AscendingOrder);
}
예제 #11
0
PlaylistView::PlaylistView(UDJServerConnection* serverConnection, MusicLibrary* musicLibrary, QWidget* parent):
  QTableView(parent),
  musicLibrary(musicLibrary),
  serverConnection(serverConnection)
{
  playlistModel = new PlaylistModel(serverConnection, this);
  horizontalHeader()->setStretchLastSection(true);
  setItemDelegateForColumn(6, new PlaylistDelegate(this));
  setModel(playlistModel);
  setColumnHidden(0,true);
  setColumnHidden(1,true);
  setColumnHidden(5,true);
  setSelectionBehavior(QAbstractItemView::SelectRows);
}
예제 #12
0
//--------------------
CalendarTreeView::CalendarTreeView( QWidget *parent )
    : TreeViewBase( parent )
{
    header()->setContextMenuPolicy( Qt::CustomContextMenu );
    setModel( new CalendarItemModel() );

    setSelectionBehavior( QAbstractItemView::SelectRows );
    setSelectionMode( QAbstractItemView::SingleSelection );
    setSelectionModel( new QItemSelectionModel( model() ) );

    setItemDelegateForColumn( 1, new EnumDelegate( this ) ); // timezone

    connect( header(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(headerContextMenuRequested(QPoint)) );
}
예제 #13
0
QmlJSPropertyInspector::QmlJSPropertyInspector(QWidget *parent)
    : QTreeView(parent)
{
    setAttribute(Qt::WA_MacShowFocusRect, false);
    setFrameStyle(QFrame::NoFrame);
    setExpandsOnDoubleClick(true);

    header()->setResizeMode(QHeaderView::ResizeToContents);
    header()->setMinimumSectionSize(150);
    setRootIsDecorated(false);

    setItemDelegateForColumn(1, new PropertyEditDelegate(this));

    m_filter = new PropertiesFilter(this);
    m_filter->setSourceModel(&m_model);
    setModel(m_filter);
}
QmlJSOutlineTreeView::QmlJSOutlineTreeView(QWidget *parent) :
    Utils::NavigationTreeView(parent)
{
    setExpandsOnDoubleClick(false);

    setDragEnabled(true);
    viewport()->setAcceptDrops(true);
    setDropIndicatorShown(true);
    setDragDropMode(InternalMove);

    setRootIsDecorated(false);

    Utils::AnnotatedItemDelegate *itemDelegate = new Utils::AnnotatedItemDelegate(this);
    itemDelegate->setDelimiter(QLatin1String(" "));
    itemDelegate->setAnnotationRole(QmlOutlineModel::AnnotationRole);
    setItemDelegateForColumn(0, itemDelegate);
}
 DataManagerPropertyView::DataManagerPropertyView(QWidget* parent):QTreeView(parent)
 {
    QList<QString> labels;
    labels.push_back("Name");
    labels.push_back("Value");
    m_model= new QStandardItemModel();
    m_model->setColumnCount(2);
    m_model->setHorizontalHeaderLabels(labels);
    setModel(m_model);
    setFrameStyle(QFrame::NoFrame);
    setAttribute(Qt::WA_MacShowFocusRect, false);
    setAlternatingRowColors(true);
    setItemDelegateForColumn(1, new DataManagerPropertyDelegate(this));
    setEditTriggers(QAbstractItemView::AllEditTriggers);
    connect(this, SIGNAL(expanded ( const QModelIndex &)), this, SLOT(expanded ( const QModelIndex &)));
    connect(this, SIGNAL(collapsed ( const QModelIndex &)), this, SLOT(collapsed ( const QModelIndex &)));
 }
예제 #16
0
DetailedErrorView::DetailedErrorView(QWidget *parent) :
    QTreeView(parent),
    m_copyAction(new QAction(this))
{
    header()->setSectionResizeMode(QHeaderView::ResizeToContents);
    setItemDelegateForColumn(LocationColumn, new Internal::DetailedErrorDelegate(this));

    m_copyAction->setText(tr("Copy"));
    m_copyAction->setIcon(Utils::Icons::COPY.icon());
    m_copyAction->setShortcut(QKeySequence::Copy);
    m_copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    connect(m_copyAction, &QAction::triggered, [this] {
        const QModelIndexList selectedRows = selectionModel()->selectedRows();
        QTC_ASSERT(selectedRows.count() == 1, return);
        QApplication::clipboard()->setText(model()->data(selectedRows.first(),
                                                         FullTextRole).toString());
    });
예제 #17
0
TransferListView::TransferListView(bool place, QWidget* _p, const QString& _name)
    : QTreeWidget(_p), mGroupMode(None) {

    mName = _name;

    QStringList headers;
    headers << tr("User") << tr("File") << tr("Status") << tr("Progress") << tr("Place") << tr("Position") << tr("Size") << tr("Speed") << tr("Time Left") << tr("Path") << QString::null;

    setAllColumnsShowFocus(true);
    setHeaderLabels(headers);
    setSortingEnabled ( false );
    sortItems(0, Qt::AscendingOrder);
    setDragEnabled(true);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setAutoScroll(false);

    if(! place)
        setColumnHidden(4, true);

    setColumnWidth ( 0, 100 );
    setColumnWidth ( 1, 250 );
    setColumnWidth ( 2, 100 );
    setColumnWidth ( 3, 115 );
    setColumnWidth ( 4, 50 );
    setColumnWidth ( 5, 75 );
    setColumnWidth ( 6, 75 );
    setColumnWidth ( 7, 75 );
    setColumnWidth ( 8, 95 );
    setColumnWidth ( 9, 230 );
    setColumnWidth ( 10, 0 );

    // Define the progress bar for the progress column
    mProgressBar = new TransferListItemProgress(this);
    setItemDelegateForColumn( 3, mProgressBar );

    if (museeq->settings()->value("saveTransfersLayout", false).toBool()) {
        QString optionName = "transfers-"+mName+"_Layout";
        header()->restoreState(museeq->settings()->value(optionName).toByteArray());
    }

    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(museeq, SIGNAL(disconnected()), SLOT(clear()));
    connect(museeq, SIGNAL(closingMuseeq()), this, SLOT(onClosingMuseeq()));
}
ItemLibraryTreeView::ItemLibraryTreeView(QWidget *parent) :
    QTreeView(parent)
{
    setDragEnabled(true);
    setDragDropMode(QAbstractItemView::DragOnly);
    setUniformRowHeights(true);
    connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(activateItem(QModelIndex)));
    setHeaderHidden(true);
    setIndentation(20);
    setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setAttribute(Qt::WA_MacShowFocusRect, false);

    TreeViewStyle *style = new TreeViewStyle;
    setStyle(style);
    style->setParent(this);
    m_delegate = new ResourceItemDelegate(this);
    setItemDelegateForColumn(0, m_delegate);
}
MusicQueryTableWidget::MusicQueryTableWidget(QWidget *parent)
    : MusicAbstractTableWidget(parent)
{
#ifndef USE_MULTIPLE_QUERY
       m_downLoadManager = new MusicDownLoadQuerySingleThread(this);
#else
       m_downLoadManager = new MusicDownLoadQueryMultipleThread(this);
#endif
    connect(m_downLoadManager, SIGNAL(clearAllItems()), SLOT(clearAllItems()));
    connect(m_downLoadManager, SIGNAL(createSearchedItems(QString,QString,QString)),
                               SLOT(createSearchedItems(QString,QString,QString)));

    m_checkBoxDelegate = new MusicQueryTableDelegate(this);
    setItemDelegateForColumn(0, m_checkBoxDelegate);

    m_actionGroup = new QActionGroup(this);
    connect(m_actionGroup, SIGNAL(triggered(QAction*)), SLOT(actionGroupClick(QAction*)));
    connect(this, SIGNAL(cellDoubleClicked(int,int)), SLOT(itemDoubleClicked(int,int)));
}
MusicMyDownloadRecordWidget::MusicMyDownloadRecordWidget(QWidget *parent)
    : MusicAbstractTableWidget(parent)
{
    setColumnCount(4);
    QHeaderView *headerview = horizontalHeader();
    headerview->resizeSection(0, 10);
    headerview->resizeSection(1, 170);
    headerview->resizeSection(2, 83);
    headerview->resizeSection(3, 50);

    m_delegate = new MusicProgressBarDelegate(this);
    setItemDelegateForColumn(2, m_delegate);
    setSelectionMode(QAbstractItemView::ExtendedSelection);

    connect(this, SIGNAL(cellDoubleClicked(int,int)), SLOT(listCellDoubleClicked(int,int)));
    musicSongsFileName();

    M_CONNECTION_PTR->setValue(getClassName(), this);
    M_CONNECTION_PTR->poolConnect(getClassName(), MusicSongsSummarizied::getClassName());
}
예제 #21
0
QgsColorSchemeList::QgsColorSchemeList( QWidget *parent , QgsColorScheme *scheme, const QString context, const QColor baseColor )
    : QTreeView( parent )
    , mScheme( scheme )
{
  mModel = new QgsColorSchemeModel( scheme, context, baseColor, this );
  //for testing:
  //new ModelTest( mModel, this );
  setModel( mModel );

  mSwatchDelegate = new QgsColorSwatchDelegate( this );
  setItemDelegateForColumn( 0, mSwatchDelegate );

  setRootIsDecorated( false );
  setSelectionMode( QAbstractItemView::ExtendedSelection );
  setSelectionBehavior( QAbstractItemView::SelectRows );
  setDragEnabled( true );
  setAcceptDrops( true );
  setDragDropMode( QTreeView::DragDrop );
  setDropIndicatorShown( true );
  setDefaultDropAction( Qt::MoveAction );
}
예제 #22
0
UserMenuTree::UserMenuTree(QWidget *parent)
	: QTreeWidget(parent)
{
	setColumnCount(2);

	header()->setResizeMode(0,QHeaderView::Stretch);
	header()->setResizeMode(1,QHeaderView::Fixed);
	header()->setMovable(false);
	header()->setStretchLastSection(false);
	setColumnWidth(1,140);
	setItemDelegateForColumn(0, new MenuentryDelegate(parent));

	// drag and drop
	setDragEnabled(true);
	setDropIndicatorShown(true);
	//setAcceptDrops(true);
	setDragDropMode(QAbstractItemView::InternalMove);
	setDragDropOverwriteMode(false);

	initEnvPathlist();
}
예제 #23
0
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false),
	currentHeaderClicked(-1), searchBox(new QLineEdit(this))
{
	setUniformRowHeights(true);
	setItemDelegateForColumn(TreeItemDT::RATING, new StarWidgetsDelegate());
	QSortFilterProxyModel *model = new QSortFilterProxyModel(this);
	model->setSortRole(TreeItemDT::SORT_ROLE);
	model->setFilterKeyColumn(-1); // filter all columns
	setModel(model);
	setSortingEnabled(false);
	setContextMenuPolicy(Qt::DefaultContextMenu);
	header()->setContextMenuPolicy(Qt::ActionsContextMenu);
	QAction *showSearchBox = new QAction(tr("Show Search Box"), this);
	showSearchBox->setShortcut( Qt::CTRL + Qt::Key_F);
	showSearchBox->setShortcutContext(Qt::ApplicationShortcut);
	addAction(showSearchBox);

	searchBox->installEventFilter(this);
	searchBox->hide();
	connect(showSearchBox, SIGNAL(triggered(bool)), this, SLOT(showSearchEdit()));
	connect(searchBox, SIGNAL(textChanged(QString)), model, SLOT(setFilterFixedString(QString)));
}
예제 #24
0
PacketList::PacketList(QWidget *parent) :
    QTreeView(parent),
    proto_tree_(NULL),
    byte_view_tab_(NULL),
    cap_file_(NULL),
    decode_as_(NULL),
    ctx_column_(-1),
    create_near_overlay_(true),
    create_far_overlay_(true),
    capture_in_progress_(false),
    tail_timer_id_(0),
    rows_inserted_(false)
{
    QMenu *main_menu_item, *submenu;
    QAction *action;

    setItemsExpandable(false);
    setRootIsDecorated(false);
    setSortingEnabled(true);
    setUniformRowHeights(true);
    setAccessibleName("Packet list");
    setItemDelegateForColumn(0, &related_packet_delegate_);

    overlay_sb_ = new OverlayScrollBar(Qt::Vertical, this);
    setVerticalScrollBar(overlay_sb_);
    overlay_timer_id_ = startTimer(overlay_update_interval_);

    packet_list_model_ = new PacketListModel(this, cap_file_);
    setModel(packet_list_model_);
    sortByColumn(-1, Qt::AscendingOrder);

    // XXX We might want to reimplement setParent() and fill in the context
    // menu there.
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditMarkPacket"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditIgnorePacket"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditSetTimeReference"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditTimeShift"));
    ctx_menu_.addAction(window()->findChild<QAction *>("actionEditPacketComment"));

    ctx_menu_.addSeparator();

    ctx_menu_.addAction(window()->findChild<QAction *>("actionViewEditResolvedName"));
    ctx_menu_.addSeparator();

    main_menu_item = window()->findChild<QMenu *>("menuApplyAsFilter");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrNotSelected"));

    main_menu_item = window()->findChild<QMenu *>("menuPrepareAFilter");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndNotSelected"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrNotSelected"));

    const char *conv_menu_name = "menuConversationFilter";
    main_menu_item = window()->findChild<QMenu *>(conv_menu_name);
    conv_menu_.setTitle(main_menu_item->title());
    conv_menu_.setObjectName(conv_menu_name);
    ctx_menu_.addMenu(&conv_menu_);

    const char *colorize_menu_name = "menuColorizeConversation";
    main_menu_item = window()->findChild<QMenu *>(colorize_menu_name);
    colorize_menu_.setTitle(main_menu_item->title());
    colorize_menu_.setObjectName(colorize_menu_name);
    ctx_menu_.addMenu(&colorize_menu_);

    main_menu_item = window()->findChild<QMenu *>("menuSCTP");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);
    submenu->addAction(window()->findChild<QAction *>("actionSCTPAnalyseThisAssociation"));
    submenu->addAction(window()->findChild<QAction *>("actionSCTPShowAllAssociations"));
    submenu->addAction(window()->findChild<QAction *>("actionSCTPFilterThisAssociation"));

    main_menu_item = window()->findChild<QMenu *>("menuFollow");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowTCPStream"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowUDPStream"));
    submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowSSLStream"));

    ctx_menu_.addSeparator();

    main_menu_item = window()->findChild<QMenu *>("menuEditCopy");
    submenu = new QMenu(main_menu_item->title());
    ctx_menu_.addMenu(submenu);

    action = submenu->addAction(tr("Summary as Text"));
    action->setData(copy_summary_text_);
    connect(action, SIGNAL(triggered()), this, SLOT(copySummary()));
    action = submenu->addAction(tr(UTF8_HORIZONTAL_ELLIPSIS "as CSV"));
    action->setData(copy_summary_csv_);
    connect(action, SIGNAL(triggered()), this, SLOT(copySummary()));
    action = submenu->addAction(tr(UTF8_HORIZONTAL_ELLIPSIS "as YAML"));
    action->setData(copy_summary_yaml_);
    connect(action, SIGNAL(triggered()), this, SLOT(copySummary()));
    submenu->addSeparator();

    submenu->addAction(window()->findChild<QAction *>("actionEditCopyAsFilter"));
    submenu->addSeparator();

    action = window()->findChild<QAction *>("actionContextCopyBytesHexTextDump");
    submenu->addAction(action);
    copy_actions_ << action;
    action = window()->findChild<QAction *>("actionContextCopyBytesHexDump");
    submenu->addAction(action);
    copy_actions_ << action;
    action = window()->findChild<QAction *>("actionContextCopyBytesPrintableText");
    submenu->addAction(action);
    copy_actions_ << action;
    action = window()->findChild<QAction *>("actionContextCopyBytesHexStream");
    submenu->addAction(action);
    copy_actions_ << action;
    action = window()->findChild<QAction *>("actionContextCopyBytesBinary");
    submenu->addAction(action);
    copy_actions_ << action;

    ctx_menu_.addSeparator();
    ctx_menu_.addMenu(&proto_prefs_menu_);
    decode_as_ = window()->findChild<QAction *>("actionAnalyzeDecodeAs");
    ctx_menu_.addAction(decode_as_);
    // "Print" not ported intentionally
    action = window()->findChild<QAction *>("actionViewShowPacketInNewWindow");
    ctx_menu_.addAction(action);

    initHeaderContextMenu();

    g_assert(gbl_cur_packet_list == NULL);
    gbl_cur_packet_list = this;

    connect(packet_list_model_, SIGNAL(goToPacket(int)), this, SLOT(goToPacket(int)));
    connect(packet_list_model_, SIGNAL(itemHeightChanged(const QModelIndex&)), this, SLOT(updateRowHeights(const QModelIndex&)));
    connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(redrawVisiblePackets()));

    header()->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(header(), SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showHeaderMenu(QPoint)));
    connect(header(), SIGNAL(sectionResized(int,int,int)),
            this, SLOT(sectionResized(int,int,int)));
    connect(header(), SIGNAL(sectionMoved(int,int,int)),
            this, SLOT(sectionMoved(int,int,int)));

    connect(verticalScrollBar(), SIGNAL(actionTriggered(int)), this, SLOT(vScrollBarActionTriggered(int)));

    connect(&proto_prefs_menu_, SIGNAL(showProtocolPreferences(QString)),
            this, SIGNAL(showProtocolPreferences(QString)));
    connect(&proto_prefs_menu_, SIGNAL(editProtocolPreference(preference*,pref_module*)),
            this, SIGNAL(editProtocolPreference(preference*,pref_module*)));
}
예제 #25
0
CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
    bool createAndDelete, bool sorting, CSMDoc::Document& document)
: DragRecordTable(document), mCreateAction (0),
  mCloneAction(0),mRecordStatusDisplay (0)
{
    CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
    QString jumpSetting = settings.settingValue ("table-input/jump-to-added");
    if (jumpSetting.isEmpty() || jumpSetting == "Jump and Select") // default
    {
        mJumpToAddedRecord = true;
        mUnselectAfterJump = false;
    }
    else if(jumpSetting == "Jump Only")
    {
        mJumpToAddedRecord = true;
        mUnselectAfterJump = true;
    }
    else
    {
        mJumpToAddedRecord = false;
        mUnselectAfterJump = false;
    }

    mModel = &dynamic_cast<CSMWorld::IdTableBase&> (*mDocument.getData().getTableModel (id));

    bool isInfoTable = id.getType() == CSMWorld::UniversalId::Type_TopicInfos ||
                       id.getType() == CSMWorld::UniversalId::Type_JournalInfos;
    if (isInfoTable)
    {
        mProxyModel = new CSMWorld::InfoTableProxyModel(id.getType(), this);
    }
    else
    {
        mProxyModel = new CSMWorld::IdTableProxyModel (this);
    }
    mProxyModel->setSourceModel (mModel);

    mDispatcher = new CSMWorld::CommandDispatcher (document, id, this);

    setModel (mProxyModel);
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
    horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
#else
    horizontalHeader()->setResizeMode (QHeaderView::Interactive);
#endif
    verticalHeader()->hide();
    setSortingEnabled (sorting);
    setSelectionBehavior (QAbstractItemView::SelectRows);
    setSelectionMode (QAbstractItemView::ExtendedSelection);

    int columns = mModel->columnCount();

    for (int i=0; i<columns; ++i)
    {
        int flags = mModel->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Flags).toInt();

        if (flags & CSMWorld::ColumnBase::Flag_Table)
        {
            CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display> (
                mModel->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());

            CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate (display,
                mDispatcher, document, this);

            mDelegates.push_back (delegate);
            setItemDelegateForColumn (i, delegate);
        }
        else
            hideColumn (i);
    }

    mEditAction = new QAction (tr ("Edit Record"), this);
    connect (mEditAction, SIGNAL (triggered()), this, SLOT (editRecord()));
    addAction (mEditAction);

    if (createAndDelete)
    {
        mCreateAction = new QAction (tr ("Add Record"), this);
        connect (mCreateAction, SIGNAL (triggered()), this, SIGNAL (createRequest()));
        addAction (mCreateAction);

        mCloneAction = new QAction (tr ("Clone Record"), this);
        connect(mCloneAction, SIGNAL (triggered()), this, SLOT (cloneRecord()));
        addAction(mCloneAction);
    }

    mRevertAction = new QAction (tr ("Revert Record"), this);
    connect (mRevertAction, SIGNAL (triggered()), mDispatcher, SLOT (executeRevert()));
    addAction (mRevertAction);

    mDeleteAction = new QAction (tr ("Delete Record"), this);
    connect (mDeleteAction, SIGNAL (triggered()), mDispatcher, SLOT (executeDelete()));
    addAction (mDeleteAction);

    mMoveUpAction = new QAction (tr ("Move Up"), this);
    connect (mMoveUpAction, SIGNAL (triggered()), this, SLOT (moveUpRecord()));
    addAction (mMoveUpAction);

    mMoveDownAction = new QAction (tr ("Move Down"), this);
    connect (mMoveDownAction, SIGNAL (triggered()), this, SLOT (moveDownRecord()));
    addAction (mMoveDownAction);

    mEditCellAction = new QAction( tr("Edit Cell"), this );
    connect( mEditCellAction, SIGNAL(triggered()), this, SLOT(editCell()) );
    addAction( mEditCellAction );

    mViewAction = new QAction (tr ("View"), this);
    connect (mViewAction, SIGNAL (triggered()), this, SLOT (viewRecord()));
    addAction (mViewAction);

    mPreviewAction = new QAction (tr ("Preview"), this);
    connect (mPreviewAction, SIGNAL (triggered()), this, SLOT (previewRecord()));
    addAction (mPreviewAction);

    /// \todo add a user option, that redirects the extended action to an input panel (in
    /// the bottom bar) that lets the user select which record collections should be
    /// modified.

    mExtendedDeleteAction = new QAction (tr ("Extended Delete Record"), this);
    connect (mExtendedDeleteAction, SIGNAL (triggered()), mDispatcher, SLOT (executeExtendedDelete()));
    addAction (mExtendedDeleteAction);

    mExtendedRevertAction = new QAction (tr ("Extended Revert Record"), this);
    connect (mExtendedRevertAction, SIGNAL (triggered()), mDispatcher, SLOT (executeExtendedRevert()));
    addAction (mExtendedRevertAction);

    connect (mProxyModel, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
        this, SLOT (tableSizeUpdate()));

    connect (mProxyModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
        this, SLOT (rowsInsertedEvent(const QModelIndex&, int, int)));

    /// \note This signal could instead be connected to a slot that filters out changes not affecting
    /// the records status column (for permanence reasons)
    connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
        this, SLOT (tableSizeUpdate()));

    connect (selectionModel(), SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
        this, SLOT (selectionSizeUpdate ()));

    setAcceptDrops(true);

    mDoubleClickActions.insert (std::make_pair (Qt::NoModifier, Action_InPlaceEdit));
    mDoubleClickActions.insert (std::make_pair (Qt::ShiftModifier, Action_EditRecord));
    mDoubleClickActions.insert (std::make_pair (Qt::ControlModifier, Action_View));
    mDoubleClickActions.insert (std::make_pair (Qt::ShiftModifier | Qt::ControlModifier, Action_EditRecordAndClose));
}
예제 #26
0
void PlaylistView::SetItemDelegates(LibraryBackend* backend) {
  rating_delegate_ = new RatingItemDelegate(this);

  setItemDelegate(new PlaylistDelegateBase(this));
  setItemDelegateForColumn(Playlist::Column_Title, new TextItemDelegate(this));
  setItemDelegateForColumn(Playlist::Column_Album,
      new TagCompletionItemDelegate(this, backend, Playlist::Column_Album));
  setItemDelegateForColumn(Playlist::Column_Artist,
      new TagCompletionItemDelegate(this, backend, Playlist::Column_Artist));
  setItemDelegateForColumn(Playlist::Column_AlbumArtist,
      new TagCompletionItemDelegate(this, backend, Playlist::Column_AlbumArtist));
  setItemDelegateForColumn(Playlist::Column_Genre,
      new TagCompletionItemDelegate(this, backend, Playlist::Column_Genre));
  setItemDelegateForColumn(Playlist::Column_Composer,
      new TagCompletionItemDelegate(this, backend, Playlist::Column_Composer));
  setItemDelegateForColumn(Playlist::Column_Length, new LengthItemDelegate(this));
  setItemDelegateForColumn(Playlist::Column_Filesize, new SizeItemDelegate(this));
  setItemDelegateForColumn(Playlist::Column_Filetype, new FileTypeItemDelegate(this));
  setItemDelegateForColumn(Playlist::Column_DateCreated, new DateItemDelegate(this));
  setItemDelegateForColumn(Playlist::Column_DateModified, new DateItemDelegate(this));
  setItemDelegateForColumn(Playlist::Column_BPM, new PlaylistDelegateBase(this, tr("bpm")));
  setItemDelegateForColumn(Playlist::Column_Samplerate, new PlaylistDelegateBase(this, ("Hz")));
  setItemDelegateForColumn(Playlist::Column_Bitrate, new PlaylistDelegateBase(this, tr("kbps")));
  setItemDelegateForColumn(Playlist::Column_Filename, new NativeSeparatorsDelegate(this));
  setItemDelegateForColumn(Playlist::Column_Rating, rating_delegate_);
  setItemDelegateForColumn(Playlist::Column_LastPlayed, new LastPlayedItemDelegate(this));
}
예제 #27
0
FieldView::FieldView(QWidget* parent)
    : QTreeView(parent), m_mapper(new QSignalMapper(this))
{
    //Item action
    m_delItem = new QAction(tr("Delete Item"),this);
    m_applyValueOnSelection = new QAction(tr("Apply on Selection"),this);
    m_applyValueOnAllLines = new QAction(tr("Apply on all lines"),this);
    m_defineCode = new QAction(tr("Define Field Code"),this);
    m_resetCode = new QAction(tr("Reset Field Code"),this);

    m_showGeometryGroup = new QAction(tr("Position columns"),this);
    connect(m_showGeometryGroup,&QAction::triggered,this,[=](){
        hideAllColumns(true);
        showColumn(CharacterSheetItem::ID);
        showColumn(CharacterSheetItem::LABEL);
        showColumn(CharacterSheetItem::X);
        showColumn(CharacterSheetItem::Y);
        showColumn(CharacterSheetItem::WIDTH);
        showColumn(CharacterSheetItem::HEIGHT);
        showColumn(CharacterSheetItem::PAGE);
    });
    m_showEsteticGroup= new QAction(tr("Esthetic columns"),this);
    connect(m_showEsteticGroup,&QAction::triggered,this,[=](){
        hideAllColumns(true);
        showColumn(CharacterSheetItem::ID);
        showColumn(CharacterSheetItem::LABEL);
        showColumn(CharacterSheetItem::BGCOLOR);
        showColumn(CharacterSheetItem::BORDER);
        showColumn(CharacterSheetItem::CLIPPED);
        showColumn(CharacterSheetItem::FONT);
        showColumn(CharacterSheetItem::TEXT_ALIGN);
        showColumn(CharacterSheetItem::TEXTCOLOR);
    });
    m_showValueGroup= new QAction(tr("Value columns"),this);
    connect(m_showValueGroup,&QAction::triggered,this,[=](){
        hideAllColumns(true);
        showColumn(CharacterSheetItem::ID);
        showColumn(CharacterSheetItem::LABEL);
        showColumn(CharacterSheetItem::VALUE);
        showColumn(CharacterSheetItem::VALUES);
        showColumn(CharacterSheetItem::TYPE);
    });
    m_showIdGroup= new QAction(tr("Id columns"),this);
    connect(m_showIdGroup,&QAction::triggered,this,[=](){
        hideAllColumns(true);
        showColumn(CharacterSheetItem::ID);
        showColumn(CharacterSheetItem::LABEL);
    });

    m_showAllGroup= new QAction(tr("All columns"),this);
    connect(m_showAllGroup,&QAction::triggered,this,[=](){
        hideAllColumns(false);
    });

    setAlternatingRowColors(true);
#ifdef Q_OS_MACX
    setAlternatingRowColors(false);
#endif

    connect(this,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(editColor(QModelIndex)));

    AlignmentDelegate* delegate = new AlignmentDelegate(this);
    setItemDelegateForColumn(static_cast<int>(CharacterSheetItem::TEXT_ALIGN),delegate);

    TypeDelegate* typeDelegate = new TypeDelegate(this);
    setItemDelegateForColumn(static_cast<int>(CharacterSheetItem::TYPE),typeDelegate);

    FontDelegate* fontDelegate = new FontDelegate(this);
    setItemDelegateForColumn(static_cast<int>(CharacterSheetItem::FONT),fontDelegate);

    PageDelegate* pageDelegate = new PageDelegate(this);
    setItemDelegateForColumn(static_cast<int>(CharacterSheetItem::PAGE),pageDelegate);

    setItemDelegateForColumn(CharacterSheetItem::BORDER,new BorderListEditor);

    connect(m_mapper,static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped),this,[this](int i)
    {
        this->setColumnHidden(i,!this->isColumnHidden(i));
    });
}
예제 #28
0
파일: table.cpp 프로젝트: Riverwolf/openmw
CSVWorld::Table::Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack,
    bool createAndDelete)
    : mUndoStack (undoStack), mCreateAction (0), mEditLock (false), mRecordStatusDisplay (0)
{
    mModel = &dynamic_cast<CSMWorld::IdTable&> (*data.getTableModel (id));

    mProxyModel = new CSMWorld::IdTableProxyModel (this);
    mProxyModel->setSourceModel (mModel);

    setModel (mProxyModel);
    horizontalHeader()->setResizeMode (QHeaderView::Interactive);
    verticalHeader()->hide();
    setSortingEnabled (true);
    setSelectionBehavior (QAbstractItemView::SelectRows);
    setSelectionMode (QAbstractItemView::ExtendedSelection);

    int columns = mModel->columnCount();

    for (int i=0; i<columns; ++i)
    {
        int flags = mModel->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Flags).toInt();

        if (flags & CSMWorld::ColumnBase::Flag_Table)
        {
            CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display> (
                mModel->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());

            CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate (display,
                undoStack, this);

            mDelegates.push_back (delegate);
            setItemDelegateForColumn (i, delegate);
        }
        else
            hideColumn (i);
    }

    mEditAction = new QAction (tr ("Edit Record"), this);
    connect (mEditAction, SIGNAL (triggered()), this, SLOT (editRecord()));
    addAction (mEditAction);

    if (createAndDelete)
    {
        mCreateAction = new QAction (tr ("Add Record"), this);
        connect (mCreateAction, SIGNAL (triggered()), this, SIGNAL (createRequest()));
        addAction (mCreateAction);
    }

    mRevertAction = new QAction (tr ("Revert Record"), this);
    connect (mRevertAction, SIGNAL (triggered()), this, SLOT (revertRecord()));
    addAction (mRevertAction);

    mDeleteAction = new QAction (tr ("Delete Record"), this);
    connect (mDeleteAction, SIGNAL (triggered()), this, SLOT (deleteRecord()));
    addAction (mDeleteAction);

    connect (mProxyModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
        this, SLOT (tableSizeUpdate()));

    /// \note This signal could instead be connected to a slot that filters out changes not affecting
    /// the records status column (for permanence reasons)
    connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
        this, SLOT (tableSizeUpdate()));

    connect (selectionModel(), SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
        this, SLOT (selectionSizeUpdate ()));
}
예제 #29
0
void XTableView::setItemDelegateForColumn(const QString column, QAbstractItemDelegate * delegate)
{
  setItemDelegateForColumn(columnIndex(column), delegate);
}
예제 #30
0
FitTreeWidget::FitTreeWidget(QWidget *parent) :
    QTreeWidget(parent)
{
setItemDelegateForColumn(0, new MyDelegate(this));
}