void MyMainWindow::start_crypto(int crypto_type) { // check if the password fields match if(ui->password_0->text() == ui->password_1->text()) { QString pass = ui->password_0->text(); QString encrypt_name; bool checked = false; // make sure that there is actually something selected in the model for cryptography for(int n = file_model->rowCount(), i = 0; i < n; i++) { if(file_model->data(file_model->index(i, MyFileSystemModelPublic::CHECKED_HEADER), Qt::CheckStateRole) == Qt::Checked) { checked = true; break; } } // check that the password is long enough if(pass.toUtf8().size() < MIN_PASS_LENGTH) { QString num_text = QString::number(MIN_PASS_LENGTH); QString warn_text = QString("The password entered was too short. ") + "Please enter a longer " "one (at least " + num_text + " ASCII characters/bytes) before continuing."; QMessageBox::warning(this, "Password too short!", warn_text); } // give the user a warning message if nothing was selected else if(!checked) { QString crypto_text = (crypto_type == START_ENCRYPT) ? "encryption!" : "decryption!"; QString warn_text = QString("There were no items selected for " + crypto_text); QMessageBox::warning(this, "Nothing selected!", warn_text); } else { // start the encryption process bool delete_success = ui->delete_success->isChecked(); MyFileSystemModelPtr clone_model(file_model->cloneByValue()); /* MyAbstractBarPtr ptr_mpb = (crypto_type == START_ENCRYPT) ? MyAbstractBarPtr(new MyEncryptBar(this, clone_model.get(), pass, delete_success)) : MyAbstractBarPtr(new MyDecryptBar(this, clone_model.get(), pass, delete_success)); */ MyAbstractBarPtr ptr_mpb; if(crypto_type == START_ENCRYPT) { // check if the user wants to rename the encrypted files to something else if(ui->encrypt_rename->isChecked()) { encrypt_name = ui->encrypt_filename->text(); ptr_mpb = MyAbstractBarPtr(new MyEncryptBar(this, clone_model.get(), pass, delete_success, &encrypt_name)); } else { ptr_mpb = MyAbstractBarPtr(new MyEncryptBar(this, clone_model.get(), pass, delete_success)); } } else ptr_mpb = MyAbstractBarPtr(new MyDecryptBar(this, clone_model.get(), pass, delete_success)); if(ptr_mpb != nullptr) ptr_mpb->exec(); // after crypto, replace the old model with the new one setModel(clone_model.release()); // clear the password fields when done ui->password_0->clear(); ui->password_1->clear(); } } else QMessageBox::warning(this, "Passwords do not match!", "The password fields do not match! " "Please make sure they were entered correctly and try again."); }
void FoursquarePlugin::initialize() { FoursquareModel *model = new FoursquareModel( marbleModel(), this ); setModel( model ); setNumberOfItems( 20 ); // Do we hardcode that? }
PacketList::PacketList(QWidget *parent) : QTreeView(parent), proto_tree_(NULL), byte_view_tab_(NULL), cap_file_(NULL), decode_as_(NULL), ctx_column_(-1), overlay_timer_id_(0), create_near_overlay_(true), create_far_overlay_(true), capture_in_progress_(false), tail_timer_id_(0), rows_inserted_(false), columns_changed_(false), set_column_visibility_(false) { QMenu *main_menu_item, *submenu; QAction *action; setItemsExpandable(false); setRootIsDecorated(false); setSortingEnabled(true); setUniformRowHeights(true); setAccessibleName("Packet list"); overlay_sb_ = new OverlayScrollBar(Qt::Vertical, this); setVerticalScrollBar(overlay_sb_); 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*))); }
void parsePartitions(analdef *adef, rawdata *rdta, tree *tr) { FILE *f; int numberOfModels = 0; int nbytes = 0; char *ch; char *cc = (char *)NULL; char **p_names; int n, i, l; int lower, upper, modulo; char buf[256]; int **partitions; int pairsCount; int as, j; int k; f = myfopen(modelFileName, "rb"); while(myGetline(&cc, &nbytes, f) > -1) { if(!lineContainsOnlyWhiteChars(cc)) { numberOfModels++; } if(cc) rax_free(cc); cc = (char *)NULL; } rewind(f); p_names = (char **)malloc(sizeof(char *) * numberOfModels); partitions = (int **)malloc(sizeof(int *) * numberOfModels); tr->initialPartitionData = (pInfo*)malloc(sizeof(pInfo) * numberOfModels); for(i = 0; i < numberOfModels; i++) { tr->initialPartitionData[i].protModels = adef->proteinMatrix; tr->initialPartitionData[i].protFreqs = adef->protEmpiricalFreqs; tr->initialPartitionData[i].dataType = -1; } for(i = 0; i < numberOfModels; i++) partitions[i] = (int *)NULL; i = 0; while(myGetline(&cc, &nbytes, f) > -1) { if(!lineContainsOnlyWhiteChars(cc)) { n = strlen(cc); p_names[i] = (char *)malloc(sizeof(char) * (n + 1)); strcpy(&(p_names[i][0]), cc); i++; } if(cc) rax_free(cc); cc = (char *)NULL; } for(i = 0; i < numberOfModels; i++) { ch = p_names[i]; pairsCount = 0; skipWhites(&ch); if(*ch == '=') { printf("Identifier missing prior to '=' in %s\n", p_names[i]); exit(-1); } analyzeIdentifier(&ch, i, tr); ch++; numberPairs: pairsCount++; partitions[i] = (int *)realloc((void *)partitions[i], (1 + 3 * pairsCount) * sizeof(int)); partitions[i][0] = pairsCount; partitions[i][3 + 3 * (pairsCount - 1)] = -1; skipWhites(&ch); if(!isNum(*ch)) { printf("%c Number expected in %s\n", *ch, p_names[i]); exit(-1); } l = 0; while(isNum(*ch)) { /*printf("%c", *ch);*/ buf[l] = *ch; ch++; l++; } buf[l] = '\0'; lower = atoi(buf); partitions[i][1 + 3 * (pairsCount - 1)] = lower; skipWhites(&ch); /* NEW */ if((*ch != '-') && (*ch != ',')) { if(*ch == '\0' || *ch == '\n' || *ch == '\r') { upper = lower; goto SINGLE_NUMBER; } else { printf("'-' or ',' expected in %s\n", p_names[i]); exit(-1); } } if(*ch == ',') { upper = lower; goto SINGLE_NUMBER; } /* END NEW */ ch++; skipWhites(&ch); if(!isNum(*ch)) { printf("%c Number expected in %s\n", *ch, p_names[i]); exit(-1); } l = 0; while(isNum(*ch)) { buf[l] = *ch; ch++; l++; } buf[l] = '\0'; upper = atoi(buf); SINGLE_NUMBER: partitions[i][2 + 3 * (pairsCount - 1)] = upper; if(upper < lower) { printf("Upper bound %d smaller than lower bound %d for this partition: %s\n", upper, lower, p_names[i]); exit(-1); } skipWhites(&ch); if(*ch == '\0' || *ch == '\n' || *ch == '\r') /* PC-LINEBREAK*/ { goto parsed; } if(*ch == ',') { ch++; goto numberPairs; } if(*ch == '\\') { ch++; skipWhites(&ch); if(!isNum(*ch)) { printf("%c Number expected in %s\n", *ch, p_names[i]); exit(-1); } l = 0; while(isNum(*ch)) { buf[l] = *ch; ch++; l++; } buf[l] = '\0'; modulo = atoi(buf); partitions[i][3 + 3 * (pairsCount - 1)] = modulo; skipWhites(&ch); if(*ch == '\0' || *ch == '\n' || *ch == '\r') { goto parsed; } if(*ch == ',') { ch++; goto numberPairs; } } assert(0); parsed: i = i; } fclose(f); /*********************************************************************************************************************/ for(i = 0; i <= rdta->sites; i++) tr->model[i] = -1; for(i = 0; i < numberOfModels; i++) { as = partitions[i][0]; for(j = 0; j < as; j++) { lower = partitions[i][1 + j * 3]; upper = partitions[i][2 + j * 3]; modulo = partitions[i][3 + j * 3]; if(modulo == -1) { for(k = lower; k <= upper; k++) setModel(i, k, tr->model); } else { for(k = lower; k <= upper; k += modulo) { if(k <= rdta->sites) setModel(i, k, tr->model); } } } } for(i = 1; i < rdta->sites + 1; i++) { if(tr->model[i] == -1) { printf("ERROR: Alignment Position %d has not been assigned any model\n", i); exit(-1); } } for(i = 0; i < numberOfModels; i++) { rax_free(partitions[i]); rax_free(p_names[i]); } rax_free(partitions); rax_free(p_names); tr->NumberOfModels = numberOfModels; if(adef->perGeneBranchLengths) { if(tr->NumberOfModels > NUM_BRANCHES) { printf("You are trying to use %d partitioned models for an individual per-gene branch length estimate.\n", tr->NumberOfModels); printf("Currently only a number of %d models/partitions is hard-coded to improve efficiency.\n", NUM_BRANCHES); printf("\n"); printf("In order to change this please replace the line \"#define NUM_BRANCHES %d\" in file \"axml.h\" \n", NUM_BRANCHES); printf("by \"#define NUM_BRANCHES %d\" and then re-compile RAxML.\n", tr->NumberOfModels); exit(-1); } else { if(tr->NumberOfModels != NUM_BRANCHES) { printf("\nWarning: for better performance under this partition scheme replace the line \"#define NUM_BRANCHES %d\" in file \"axml.h\" \n", NUM_BRANCHES); printf("by \"#define NUM_BRANCHES %d\" and then re-compile RAxML.\n", tr->NumberOfModels); } tr->numBranches = tr->NumberOfModels; } } else { if(tr->NumberOfModels < NUM_BRANCHES) { printf("\nWarning: for better performance under this partition scheme replace the line \"#define NUM_BRANCHES %d\" in file \"axml.h\" \n", NUM_BRANCHES); printf("by \"#define NUM_BRANCHES %d\" and then re-compile RAxML.\n", 1); } } }
QFPseudoTreeModelEnhancedComboBox::QFPseudoTreeModelEnhancedComboBox(QWidget *parent): QFEnhancedComboBox(parent) { m_model=new QFPseudoTreeModel(this); setModel(m_model); }
Playlist::PrettyListView::PrettyListView( QWidget* parent ) : QListView( parent ) , ViewCommon() , m_headerPressIndex( QModelIndex() ) , m_mousePressInHeader( false ) , m_skipAutoScroll( false ) , m_firstScrollToActiveTrack( true ) , m_rowsInsertedScrollItem( 0 ) , m_showOnlyMatches( false ) , m_pd( 0 ) { // QAbstractItemView basics setModel( The::playlist()->qaim() ); m_prettyDelegate = new PrettyItemDelegate( this ); connect( m_prettyDelegate, SIGNAL( redrawRequested() ), this, SLOT( redrawActive() ) ); setItemDelegate( m_prettyDelegate ); setSelectionMode( ExtendedSelection ); setDragDropMode( DragDrop ); setDropIndicatorShown( false ); // we draw our own drop indicator setEditTriggers ( SelectedClicked | EditKeyPressed ); setAutoScroll( true ); setVerticalScrollMode( ScrollPerPixel ); setMouseTracking( true ); // Rendering adjustments setFrameShape( QFrame::NoFrame ); setAlternatingRowColors( true) ; The::paletteHandler()->updateItemView( this ); connect( The::paletteHandler(), SIGNAL(newPalette(QPalette)), SLOT(newPalette(QPalette)) ); setAutoFillBackground( false ); // Signal connections connect( this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(trackActivated(QModelIndex)) ); connect( selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(slotSelectionChanged()) ); connect( LayoutManager::instance(), SIGNAL(activeLayoutChanged()), this, SLOT(playlistLayoutChanged()) ); connect( model(), SIGNAL(activeTrackChanged(quint64)), this, SLOT(slotPlaylistActiveTrackChanged()) ); connect( model(), SIGNAL(queueChanged()), viewport(), SLOT(update()) ); // Warning, this one doesn't connect to the normal 'model()' (i.e. '->top()'), but to '->bottom()'. connect( Playlist::ModelStack::instance()->bottom(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(bottomModelRowsInserted(QModelIndex,int,int)) ); // Timers m_proxyUpdateTimer = new QTimer( this ); m_proxyUpdateTimer->setSingleShot( true ); connect( m_proxyUpdateTimer, SIGNAL(timeout()), this, SLOT(updateProxyTimeout()) ); m_animationTimer = new QTimer(this); connect( m_animationTimer, SIGNAL(timeout()), this, SLOT(redrawActive()) ); m_animationTimer->setInterval( 250 ); playlistLayoutChanged(); // We do the following call here to be formally correct, but note: // - It happens to be redundant, because 'playlistLayoutChanged()' already schedules // another one, via a QTimer( 0 ). // - Both that one and this one don't work right (they scroll like 'PositionAtTop', // not 'PositionAtCenter'). This is probably because MainWindow changes its // geometry in a QTimer( 0 )? As a fix, MainWindow does a 'slotShowActiveTrack()' // at the end of its QTimer slot, which will finally scroll to the right spot. slotPlaylistActiveTrackChanged(); }
MenuBarComponent::~MenuBarComponent() { setModel (nullptr); Desktop::getInstance().removeGlobalMouseListener (this); }
void PacketList::thaw() { setModel(packet_list_model_); setUpdatesEnabled(true); setColumnVisibility(); }
void ConfigBitsView::SetDevice(Device* newDevice, DeviceData* newDeviceData) { int i, j; device = newDevice; deviceData = newDeviceData; model.clear(); model.setHorizontalHeaderItem(0, new QStandardItem("Description")); model.setHorizontalHeaderItem(1, new QStandardItem("Setting")); QList<QStandardItem*> row; Device::ConfigWord* word; unsigned int* wordValue; unsigned int* wordVerify; Device::ConfigField* field; ConfigBitsItem* item; for(i = 0; i < device->configWords.count(); i++) { word = &device->configWords[i]; wordValue = deviceData->ConfigWordPointer(word->address); if(verifyData != NULL) { wordVerify = verifyData->ConfigWordPointer(word->address); } else { wordVerify = NULL; } item = new ConfigBitsItem(device, word, wordValue); for(j = 0; j < word->fields.count(); j++) { field = &word->fields[j]; row.append(new ConfigBitsItem(device, field->description)); row.append(new ConfigBitsItem(device, field, word, wordValue, wordVerify)); item->appendRow(row); row.clear(); } row.append(item); if(wordVerify != NULL) { row.append(new ConfigBitsItem(device, word, wordValue, wordVerify)); } else { row.append(new ConfigBitsItem(device, wordValue)); } model.appendRow(row); row.clear(); } setModel(&model); setItemDelegate(new ConfigBitsDelegate(&model)); setEditTriggers(QAbstractItemView::CurrentChanged); setWordWrap(true); setRootIsDecorated(false); setUniformRowHeights(true); setDragDropMode(QAbstractItemView::NoDragDrop); expandAll(); setItemsExpandable(false); if(columnSplit) { setColumnWidth(0, columnSplit); } else { resizeColumnToContents(0); } }
PacketList::PacketList(QWidget *parent) : QTreeView(parent), proto_tree_(NULL), byte_view_tab_(NULL), cap_file_(NULL), decode_as_(NULL), ctx_column_(-1) { QMenu *submenu, *subsubmenu; QAction *action; setItemsExpandable(false); setRootIsDecorated(false); setSortingEnabled(true); setUniformRowHeights(true); setAccessibleName("Packet list"); setItemDelegateForColumn(0, &related_packet_delegate_); 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(); action = window()->findChild<QAction *>("actionFollow"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowTCPStream")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowUDPStream")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowSSLStream")); action = window()->findChild<QAction *>("actionSCTP"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); ctx_menu_.addMenu(submenu); submenu->addAction(window()->findChild<QAction *>("actionSCTPAnalyseThisAssociation")); submenu->addAction(window()->findChild<QAction *>("actionSCTPShowAllAssociations")); submenu->addAction(window()->findChild<QAction *>("actionSCTPFilterThisAssociation")); ctx_menu_.addSeparator(); // " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n" // ctx_menu_.addSeparator(); action = window()->findChild<QAction *>("actionApply_as_Filter"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); 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")); action = window()->findChild<QAction *>("actionPrepare_a_Filter"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); 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")); // action = window()->findChild<QAction *>("actionColorize_with_Filter"); // submenu = new QMenu(); // action->setMenu(submenu); // ctx_menu_.addAction(action); // " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n" // " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n" // " <menuitem name='IP' action='/Conversation Filter/IP'/>\n" // " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n" // " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n" // " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n" // " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n" // " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n" // " <menu name= 'IP' action='/Colorize Conversation/IP'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n" // " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n" // " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n" // " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n" // " <menu name= 'SCTP' action='/SCTP'>\n" // " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n" // " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n" // " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n" // " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n" // " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n" ctx_menu_.addSeparator(); action = window()->findChild<QAction *>("actionCopy"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); // " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n" // " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n" submenu->addAction(window()->findChild<QAction *>("actionEditCopyAsFilter")); submenu->addSeparator(); action = window()->findChild<QAction *>("actionBytes"); subsubmenu = new QMenu(); action->setMenu(subsubmenu); submenu->addAction(action); // " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n" // " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n" // " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n" // ctx_menu_.addSeparator(); // " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n" // " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n" ctx_menu_.addSeparator(); // " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n" decode_as_ = window()->findChild<QAction *>("actionAnalyzeDecodeAs"); ctx_menu_.addAction(decode_as_); // " <menuitem name='Print' action='/Print'/>\n" // " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n" g_assert(gbl_cur_packet_list == NULL); gbl_cur_packet_list = this; connect(packet_list_model_, SIGNAL(goToPacket(int)), this, SLOT(goToPacket(int))); connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(redrawVisiblePackets())); }
void PacketList::freeze() { setUpdatesEnabled(false); setModel(NULL); }
HeavyArmor::HeavyArmor(string name, SyukatsuGame *game, Field *field, int _level) :Character(name, game, field, _level) { setAttributes(Information::Enemies::HEAVYARMOR); setModel(Assets::enemies[Information::HEAVYARMOR]); }
void MyMainWindow::on_delete_checked_clicked() { std::vector<MyFileInfoPtr> item_list; // get a list of all the items checked for deletion for(int n = file_model->rowCount(), i = 0; i < n; i++) { if(file_model->data(file_model->index(i, MyFileSystemModelPublic::CHECKED_HEADER), Qt::CheckStateRole) == Qt::Checked) { QString full_path = file_model->data(file_model->index(i, MyFileSystemModelPublic::FULL_PATH_HEADER)).toString(); item_list.push_back(MyFileInfoPtr(new MyFileInfo(nullptr, full_path))); } } int total_items = item_list.size(); if(total_items != 0) { QMessageBox::StandardButton ret_val = QMessageBox::question(this, "Delete items?", "Are you " "sure you wish to permanently delete the selected items?", QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel); if(ret_val == QMessageBox::Ok) { std::vector<QString> result_list; for(int i = 0; i < total_items; i++) { QString full_path = item_list[i]->getFullPath(); QString item_type = item_list[i]->getType(); if(item_type == MyFileInfo::typeToString(MyFileInfoPublic::MFIT_FILE)) { if(QFile::remove(full_path)) { file_model->removeItem(full_path); result_list.push_back("Successfully deleted file!"); } else result_list.push_back("Error deleting file!"); } else if(item_type == MyFileInfo::typeToString(MyFileInfoPublic::MFIT_DIR)) { if(QDir(full_path).removeRecursively()) { file_model->removeItem(full_path); result_list.push_back("Successfully deleted directory!"); } else result_list.push_back("Error deleting directory!"); } else { file_model->removeItem(full_path); result_list.push_back("Item was not found!"); } } // items were most likely removed from the model, resize columns setModel(file_model); QString det_string; // create a string containing the list of items and results for(int i = 0; i < item_list.size(); i++) { det_string += item_list[i]->getFullPath(); det_string += "\n" + result_list[i]; if(i < item_list.size() - 1) det_string += "\n\n"; } QMessageBox del_msg(QMessageBox::Information, "Deletion completed!", "The deletion process " "was completed. Click below to show details.", QMessageBox::Close, this); del_msg.setDetailedText(det_string); del_msg.exec(); } // total_items != 0 } }
void MyMainWindow::on_add_directory_clicked() { QString dir = QFileDialog::getExistingDirectory(this, "Open Directory", QString(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(dir != QString()) { QString warn_title; QString warn_text; QString warn_detail; // don't let the user add in a root directory if(QDir(QDir(dir).absolutePath()).isRoot()) { warn_title = "Can't add a root directory!"; warn_text = "The root directory (" + dir + ") cannot be added."; QMessageBox msg_box(QMessageBox::Warning, warn_title, warn_text, QMessageBox::Close, this); msg_box.exec(); } // is the directory contained by anything already inside the model or a duplicate? else if(file_model->isRedundant(dir)) { // create message warn_title = "Directory already added!"; warn_text = "The following directory was already added. It will not be added again."; warn_detail = dir; // display in message box QMessageBox msg_box(QMessageBox::Warning, warn_title, warn_text, QMessageBox::Close, this); msg_box.setDetailedText(warn_detail); msg_box.exec(); } else { std::vector<QString> red_list = file_model->makesRedundant(dir); // check if the directory chosen makes something redundant inside the model if(red_list.size() > 0) { // ask if they want to add the directory. if so, the redundant items will be removed warn_title = "Directory makes item(s) redundant!"; warn_text = "The directory chosen (" + dir + ") contains item(s) inside it that " "were added previously. If you add this new directory, the following redundant items will " "be removed."; for(int i = 0; i < red_list.size(); i++) { warn_detail += red_list[i]; if(i != red_list.size() - 1) warn_detail += '\n'; } // display the message with Ok and Cancel buttons QMessageBox msg_box(QMessageBox::Warning, warn_title, warn_text, QMessageBox::Ok | QMessageBox::Cancel, this); msg_box.setDetailedText(warn_detail); if(msg_box.exec() == QMessageBox::Ok) { file_model->removeItems(red_list); file_model->insertItem(0, dir); file_model->startDirThread(0); // resize the columns setModel(file_model); } } // the chosen directory doesn't make anything inside the model redundant, simply add it else { file_model->insertItem(0, dir); file_model->startDirThread(0); setModel(file_model); } } } // if(dir != QString()) }
// #### ITW: InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : QWidget(), ModelView( NULL, this ), m_track( _itv->model() ), m_itv( _itv ), m_instrumentView( NULL ) { setAcceptDrops( true ); // init own layout + widgets setFocusPolicy( Qt::StrongFocus ); QVBoxLayout * vlayout = new QVBoxLayout( this ); vlayout->setMargin( 0 ); vlayout->setSpacing( 0 ); tabWidget* generalSettingsWidget = new tabWidget( tr( "GENERAL SETTINGS" ), this ); QVBoxLayout* generalSettingsLayout = new QVBoxLayout( generalSettingsWidget ); generalSettingsLayout->setContentsMargins( 8, 18, 8, 8 ); generalSettingsLayout->setSpacing( 6 ); // setup line edit for changing instrument track name m_nameLineEdit = new QLineEdit; m_nameLineEdit->setFont( pointSize<9>( m_nameLineEdit->font() ) ); connect( m_nameLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( textChanged( const QString & ) ) ); generalSettingsLayout->addWidget( m_nameLineEdit ); QHBoxLayout* basicControlsLayout = new QHBoxLayout; basicControlsLayout->setSpacing( 3 ); // set up volume knob m_volumeKnob = new knob( knobBright_26, NULL, tr( "Instrument volume" ) ); m_volumeKnob->setVolumeKnob( true ); m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" ); m_volumeKnob->setLabel( tr( "VOL" ) ); m_volumeKnob->setWhatsThis( tr( volume_help ) ); basicControlsLayout->addWidget( m_volumeKnob ); // set up panning knob m_panningKnob = new knob( knobBright_26, NULL, tr( "Panning" ) ); m_panningKnob->setHintText( tr( "Panning:" ) + " ", "" ); m_panningKnob->setLabel( tr( "PAN" ) ); basicControlsLayout->addWidget( m_panningKnob ); basicControlsLayout->addStretch(); // set up pitch knob m_pitchKnob = new knob( knobBright_26, NULL, tr( "Pitch" ) ); m_pitchKnob->setHintText( tr( "Pitch:" ) + " ", " " + tr( "cents" ) ); m_pitchKnob->setLabel( tr( "PITCH" ) ); basicControlsLayout->addWidget( m_pitchKnob ); // set up pitch range knob m_pitchRangeSpinBox= new LcdSpinBox( 2, NULL, tr( "Pitch range (semitones)" ) ); m_pitchRangeSpinBox->setLabel( tr( "RANGE" ) ); basicControlsLayout->addWidget( m_pitchRangeSpinBox ); basicControlsLayout->addStretch(); // setup spinbox for selecting FX-channel m_effectChannelNumber = new fxLineLcdSpinBox( 2, NULL, tr( "FX channel" ) ); m_effectChannelNumber->setLabel( tr( "FX" ) ); basicControlsLayout->addWidget( m_effectChannelNumber ); basicControlsLayout->addStretch(); QPushButton* saveSettingsBtn = new QPushButton( embed::getIconPixmap( "project_save" ), QString() ); saveSettingsBtn->setMinimumSize( 32, 32 ); connect( saveSettingsBtn, SIGNAL( clicked() ), this, SLOT( saveSettingsBtnClicked() ) ); toolTip::add( saveSettingsBtn, tr( "Save current channel settings in a preset-file" ) ); saveSettingsBtn->setWhatsThis( tr( "Click here, if you want to save current channel settings " "in a preset-file. Later you can load this preset by " "double-clicking it in the preset-browser." ) ); basicControlsLayout->addWidget( saveSettingsBtn ); generalSettingsLayout->addLayout( basicControlsLayout ); m_tabWidget = new tabWidget( "", this ); m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + 10 ); // create tab-widgets m_ssView = new InstrumentSoundShapingView( m_tabWidget ); // FUNC tab QWidget* instrumentFunctions = new QWidget( m_tabWidget ); QVBoxLayout* instrumentFunctionsLayout = new QVBoxLayout( instrumentFunctions ); instrumentFunctionsLayout->setMargin( 5 ); m_noteStackingView = new InstrumentFunctionNoteStackingView( &m_track->m_noteStacking ); m_arpeggioView = new InstrumentFunctionArpeggioView( &m_track->m_arpeggio ); instrumentFunctionsLayout->addWidget( m_noteStackingView ); instrumentFunctionsLayout->addWidget( m_arpeggioView ); instrumentFunctionsLayout->addStretch(); // MIDI tab m_midiView = new InstrumentMidiIOView( m_tabWidget ); // FX tab m_effectView = new EffectRackView( m_track->m_audioPort.effects(), m_tabWidget ); m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 ); m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), 2 ); m_tabWidget->addTab( m_effectView, tr( "FX" ), 3 ); m_tabWidget->addTab( m_midiView, tr( "MIDI" ), 4 ); // setup piano-widget m_pianoView = new PianoView( this ); m_pianoView->setFixedSize( INSTRUMENT_WIDTH, PIANO_HEIGHT ); vlayout->addWidget( generalSettingsWidget ); vlayout->addWidget( m_tabWidget ); vlayout->addWidget( m_pianoView ); setModel( _itv->model() ); updateInstrumentView(); setFixedWidth( INSTRUMENT_WIDTH ); resize( sizeHint() ); QMdiSubWindow * subWin = engine::mainWindow()->workspace()->addSubWindow( this ); Qt::WindowFlags flags = subWin->windowFlags(); flags |= Qt::MSWindowsFixedSizeDialogHint; flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags( flags ); subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) ); subWin->setFixedSize( subWin->size() ); subWin->hide(); }
void LayerTreeSidebar::createForms() { QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->setSpacing(0); mainLayout->setContentsMargins(0, 0, 0, 0); { auto view = new QTreeView(); if (d->uiController) view->setItemDelegate(new LayerModelViewDelegate(d->uiController, this)); view->setHeaderHidden(true); view->setSelectionMode(QAbstractItemView::ExtendedSelection); view->setDragDropMode(QAbstractItemView::DragDrop); view->setDefaultDropAction(Qt::MoveAction); view->setDropIndicatorShown(true); if (d->document) { view->setModel(d->document->layerScene()->itemModel()); view->setSelectionModel(d->document->layerScene()->itemSelectionModel()); connect(d->document->layerScene(), SIGNAL(thumbnailsUpdated(QPointSet)), view, SLOT(update())); } view->setContextMenuPolicy(Qt::CustomContextMenu); connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showViewContextMenu(QPoint))); view->installEventFilter(this); d->view = view; mainLayout->addWidget(view); } { auto lowerLayout = new QVBoxLayout(); lowerLayout->setSpacing(6); lowerLayout->setContentsMargins(6,6,6,6); { auto editor = new LayerPropertyEditor(d->document ? d->document->layerScene() : 0); lowerLayout->addWidget(editor); } // buttons { auto layout = new QHBoxLayout(); layout->setSpacing(0); auto addButton = new SimpleButton(":/icons/16x16/add.svg", QSize(16,16)); addButton->setMargins(4, 0, 4, 0); auto removeButton = new SimpleButton(":/icons/16x16/subtract.svg", QSize(16,16)); removeButton->setMargins(4, 0, 4, 0); auto miscButton = new SimpleButton(":/icons/16x16/menuDown.svg", QSize(16,16)); miscButton->setMargins(4, 0, 4, 0); if (d->uiController) { auto addMenu = new QMenu(this); addMenu->addAction(d->uiController->action(LayerUIController::ActionNewRaster)); addMenu->addAction(d->uiController->action(LayerUIController::ActionNewGroup)); addMenu->addAction(d->uiController->action(LayerUIController::ActionImport)); addButton->setMenu(addMenu); connect(removeButton, SIGNAL(pressed()), d->uiController, SLOT(removeLayers())); QMenu *miscMenu = new QMenu(this); miscMenu->addAction(d->uiController->action(LayerUIController::ActionMerge)); miscButton->setMenu(miscMenu); } layout->addWidget(addButton); layout->addWidget(removeButton); layout->addWidget(miscButton); layout->addStretch(1); lowerLayout->addLayout(layout); } mainLayout->addLayout(lowerLayout); } setLayout(mainLayout); }
InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerView* tcv ) : trackView( _it, tcv ), m_window( NULL ), m_lastPos( -1, -1 ) { setAcceptDrops( true ); setFixedHeight( 32 ); m_tlb = new trackLabelButton( this, getTrackSettingsWidget() ); m_tlb->setCheckable( true ); m_tlb->setIcon( embed::getIconPixmap( "instrument_track" ) ); m_tlb->move( 3, 1 ); m_tlb->show(); connect( m_tlb, SIGNAL( toggled( bool ) ), this, SLOT( toggleInstrumentWindow( bool ) ) ); connect( _it, SIGNAL( nameChanged() ), m_tlb, SLOT( update() ) ); // creation of widgets for track-settings-widget int widgetWidth; if( configManager::inst()->value( "ui", "compacttrackbuttons" ).toInt() ) { widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT; } else { widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH; } m_volumeKnob = new knob( knobSmall_17, getTrackSettingsWidget(), tr( "Volume" ) ); m_volumeKnob->setVolumeKnob( true ); m_volumeKnob->setModel( &_it->m_volumeModel ); m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" ); m_volumeKnob->move( widgetWidth-2*24, 2 ); m_volumeKnob->setLabel( tr( "VOL" ) ); m_volumeKnob->show(); m_volumeKnob->setWhatsThis( tr( volume_help ) ); m_panningKnob = new knob( knobSmall_17, getTrackSettingsWidget(), tr( "Panning" ) ); m_panningKnob->setModel( &_it->m_panningModel ); m_panningKnob->setHintText( tr( "Panning:" ) + " ", "%" ); m_panningKnob->move( widgetWidth-24, 2 ); m_panningKnob->setLabel( tr( "PAN" ) ); m_panningKnob->show(); m_midiMenu = new QMenu( tr( "MIDI" ), this ); // sequenced MIDI? if( !engine::mixer()->midiClient()->isRaw() ) { _it->m_midiPort.m_readablePortsMenu = new MidiPortMenu( MidiPort::Input ); _it->m_midiPort.m_writablePortsMenu = new MidiPortMenu( MidiPort::Output ); _it->m_midiPort.m_readablePortsMenu->setModel( &_it->m_midiPort ); _it->m_midiPort.m_writablePortsMenu->setModel( &_it->m_midiPort ); m_midiInputAction = m_midiMenu->addMenu( _it->m_midiPort.m_readablePortsMenu ); m_midiOutputAction = m_midiMenu->addMenu( _it->m_midiPort.m_writablePortsMenu ); } else { m_midiInputAction = m_midiMenu->addAction( "" ); m_midiOutputAction = m_midiMenu->addAction( "" ); m_midiInputAction->setCheckable( true ); m_midiOutputAction->setCheckable( true ); connect( m_midiInputAction, SIGNAL( changed() ), this, SLOT( midiInSelected() ) ); connect( m_midiOutputAction, SIGNAL( changed() ), this, SLOT( midiOutSelected() ) ); connect( &_it->m_midiPort, SIGNAL( modeChanged() ), this, SLOT( midiConfigChanged() ) ); } m_midiInputAction->setText( tr( "Input" ) ); m_midiOutputAction->setText( tr( "Output" ) ); m_activityIndicator = new fadeButton( QApplication::palette().color( QPalette::Active, QPalette::Background), QApplication::palette().color( QPalette::Active, QPalette::BrightText ), getTrackSettingsWidget() ); m_activityIndicator->setGeometry( widgetWidth-2*24-11, 2, 8, 28 ); m_activityIndicator->show(); connect( m_activityIndicator, SIGNAL( pressed() ), this, SLOT( activityIndicatorPressed() ) ); connect( m_activityIndicator, SIGNAL( released() ), this, SLOT( activityIndicatorReleased() ) ); connect( _it, SIGNAL( newNote() ), m_activityIndicator, SLOT( activate() ) ); setModel( _it ); }
PriceItemDataSetViewModel::PriceItemDataSetViewModel( PriceItemDataSetModel * m, int curPriceDataSet, MathParser * prs, QObject * parent ): QAbstractTableModel( parent ), m_d( new PriceItemDataSetViewModelPrivate( NULL, 0, prs )){ setModel(m); setCurrentPriceDataSet( curPriceDataSet ); }
lmcTransferListView::lmcTransferListView(QWidget* parent) : QListView(parent) { pModel = new FileModel(); setModel(pModel); setItemDelegate(new FileDelegate); setEditTriggers(QAbstractItemView::NoEditTriggers); }
void TagCompleter::ModelReady(QFuture<TagCompletionModel*> future) { TagCompletionModel* model = future.result(); setModel(model); setCaseSensitivity(Qt::CaseInsensitive); editor_->setCompleter(this); }
XmlTree::~XmlTree() { setModel ( 0 ); if ( m_treeModel ) delete m_treeModel; m_treeModel = 0; }
DesktopWindow::DesktopWindow(int screenNum): View(Fm::FolderView::IconMode), proxyModel_(nullptr), model_(nullptr), wallpaperMode_(WallpaperNone), slideShowInterval_(0), wallpaperTimer_(nullptr), wallpaperRandomize_(false), fileLauncher_(nullptr), showWmMenu_(false), screenNum_(screenNum), relayoutTimer_(nullptr) { QDesktopWidget* desktopWidget = QApplication::desktop(); setWindowFlags(Qt::Window | Qt::FramelessWindowHint); setAttribute(Qt::WA_X11NetWmWindowTypeDesktop); setAttribute(Qt::WA_DeleteOnClose); // set our custom file launcher View::setFileLauncher(&fileLauncher_); listView_ = static_cast<Fm::FolderViewListView*>(childView()); listView_->setMovement(QListView::Snap); listView_->setResizeMode(QListView::Adjust); listView_->setFlow(QListView::TopToBottom); // This is to workaround Qt bug 54384 which affects Qt >= 5.6 // https://bugreports.qt.io/browse/QTBUG-54384 // Setting a QPixmap larger then the screen resolution to desktop's QPalette won't work. // So we make the viewport transparent by preventing its backround from being filled automatically. // Then we paint desktop's background ourselves by using its paint event handling method. listView_->viewport()->setAutoFillBackground(false); // NOTE: When XRnadR is in use, the all screens are actually combined to form a // large virtual desktop and only one DesktopWindow needs to be created and screenNum is -1. // In some older multihead setups, such as xinerama, every physical screen // is treated as a separate desktop so many instances of DesktopWindow may be created. // In this case we only want to show desktop icons on the primary screen. if(desktopWidget->isVirtualDesktop() || screenNum_ == desktopWidget->primaryScreen()) { loadItemPositions(); Settings& settings = static_cast<Application* >(qApp)->settings(); auto desktopPath = Fm::FilePath::fromLocalPath(XdgDir::readDesktopDir().toStdString().c_str()); model_ = Fm::CachedFolderModel::modelFromPath(desktopPath); folder_ = model_->folder(); proxyModel_ = new Fm::ProxyFolderModel(); proxyModel_->setSourceModel(model_); proxyModel_->setShowThumbnails(settings.showThumbnails()); proxyModel_->sort(settings.desktopSortColumn(), settings.desktopSortOrder()); proxyModel_->setFolderFirst(settings.desktopSortFolderFirst()); setModel(proxyModel_); connect(proxyModel_, &Fm::ProxyFolderModel::rowsInserted, this, &DesktopWindow::onRowsInserted); connect(proxyModel_, &Fm::ProxyFolderModel::rowsAboutToBeRemoved, this, &DesktopWindow::onRowsAboutToBeRemoved); connect(proxyModel_, &Fm::ProxyFolderModel::layoutChanged, this, &DesktopWindow::onLayoutChanged); connect(proxyModel_, &Fm::ProxyFolderModel::sortFilterChanged, this, &DesktopWindow::onModelSortFilterChanged); connect(proxyModel_, &Fm::ProxyFolderModel::dataChanged, this, &DesktopWindow::onDataChanged); connect(listView_, &QListView::indexesMoved, this, &DesktopWindow::onIndexesMoved); } // remove frame listView_->setFrameShape(QFrame::NoFrame); // inhibit scrollbars FIXME: this should be optional in the future listView_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); listView_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(this, &DesktopWindow::openDirRequested, this, &DesktopWindow::onOpenDirRequested); listView_->installEventFilter(this); listView_->viewport()->installEventFilter(this); // setup shortcuts QShortcut* shortcut; shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_X), this); // cut connect(shortcut, &QShortcut::activated, this, &DesktopWindow::onCutActivated); shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C), this); // copy connect(shortcut, &QShortcut::activated, this, &DesktopWindow::onCopyActivated); shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_V), this); // paste connect(shortcut, &QShortcut::activated, this, &DesktopWindow::onPasteActivated); shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_A), this); // select all connect(shortcut, &QShortcut::activated, this, &FolderView::selectAll); shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), this); // delete connect(shortcut, &QShortcut::activated, this, &DesktopWindow::onDeleteActivated); shortcut = new QShortcut(QKeySequence(Qt::Key_F2), this); // rename connect(shortcut, &QShortcut::activated, this, &DesktopWindow::onRenameActivated); shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F2), this); // bulk rename connect(shortcut, &QShortcut::activated, this, &DesktopWindow::onBulkRenameActivated); shortcut = new QShortcut(QKeySequence(Qt::ALT + Qt::Key_Return), this); // properties connect(shortcut, &QShortcut::activated, this, &DesktopWindow::onFilePropertiesActivated); shortcut = new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Delete), this); // force delete connect(shortcut, &QShortcut::activated, this, &DesktopWindow::onDeleteActivated); }
SoundWidget::SoundWidget(SoundModel *model) : ModuleWidget(), m_speakerGroup(new SettingsGroup), m_speakerSwitch(new SwitchWidget), m_outputVolumeSliderItem(new TitledSliderItem(tr("Output Volume"))), m_outputBalanceSliderItem(new TitledSliderItem(tr("Left/Right Balance"))), m_microphoneGroup(new SettingsGroup), m_microphoneSwitch(new SwitchWidget), m_inputVolumeSliderItem(new TitledSliderItem(tr("Input Volume"))), #ifndef DCC_DISABLE_FEEDBACK m_inputFeedbackSliderItem(new TitledSliderItem(tr("Feedback Volume"))), #endif m_advancedSettingsGroup(new SettingsGroup), m_advancedSettingsItem(new NextPageWidget), m_soundEffectGroup(new SettingsGroup), m_soundEffectSwitch(new SwitchWidget) { setObjectName("Sound"); setTitle(tr("Sound")); m_speakerSwitch->setTitle(tr("Speaker")); m_gsettings = new QGSettings("com.deepin.dde.audio", "", this); m_outputVolumeSliderItem->setObjectName("OutputVolumeSliderItem"); m_outputVolumeSlider = m_outputVolumeSliderItem->slider(); m_outputVolumeSlider->setOrientation(Qt::Horizontal); // set sound slider max value onGSettingsChanged("outputVolumeMax"); m_outputBalanceSliderItem->setObjectName("OutputBalanceSliderItem"); m_outputBalanceSlider = m_outputBalanceSliderItem->slider(); m_outputBalanceSlider->setType(DCCSlider::Vernier); m_outputBalanceSlider->setOrientation(Qt::Horizontal); m_outputBalanceSlider->setRange(-100, 100); m_outputBalanceSlider->setTickInterval(100); m_outputBalanceSlider->setTickPosition(QSlider::TicksBelow); m_speakerGroup->appendItem(m_speakerSwitch); m_speakerGroup->appendItem(m_outputVolumeSliderItem); m_speakerGroup->appendItem(m_outputBalanceSliderItem); m_microphoneSwitch->setTitle(tr("Microphone")); m_inputVolumeSliderItem->setObjectName("InputVolumeSliderItem"); m_inputVolumeSlider = m_inputVolumeSliderItem->slider(); m_inputVolumeSlider->setOrientation(Qt::Horizontal); m_inputVolumeSlider->setRange(0, 150); #ifndef DCC_DISABLE_FEEDBACK m_inputFeedbackSliderItem->setObjectName("InputFeedbackSliderItem"); m_inputFeedbackSlider = m_inputFeedbackSliderItem->slider(); m_inputFeedbackSlider->setType(DCCSlider::Progress); m_inputFeedbackSlider->setOrientation(Qt::Horizontal); m_inputFeedbackSlider->setRange(0, 100); m_inputFeedbackSlider->installEventFilter(this); #endif m_microphoneGroup->appendItem(m_microphoneSwitch); m_microphoneGroup->appendItem(m_inputVolumeSliderItem); #ifndef DCC_DISABLE_FEEDBACK m_microphoneGroup->appendItem(m_inputFeedbackSliderItem); #endif m_advancedSettingsItem->setTitle(tr("Advanced")); m_advancedSettingsGroup->appendItem(m_advancedSettingsItem); m_soundEffectSwitch->setTitle(tr("Sound Effects")); m_soundEffectGroup->appendItem(m_soundEffectSwitch); m_centralLayout->addWidget(m_speakerGroup); m_centralLayout->addWidget(m_microphoneGroup); m_centralLayout->addWidget(m_advancedSettingsGroup); m_centralLayout->addWidget(m_soundEffectGroup); setModel(model); connect(m_speakerSwitch, &SwitchWidget::checkedChanged, this, &SoundWidget::requestSwitchSpeaker); connect(m_microphoneSwitch, &SwitchWidget::checkedChanged, this, &SoundWidget::requestSiwtchMicrophone); connect(m_soundEffectSwitch, &SwitchWidget::checkedChanged, this, &SoundWidget::requestSwitchSoundEffect); connect(m_outputBalanceSlider, &DCCSlider::valueChanged, [this] (double value) { emit requestSetSpeakerBalance(value / 100.f); }); connect(m_inputVolumeSlider, &DCCSlider::valueChanged, [this] (double value) { emit requestSetMicrophoneVolume(value / 100.f); }); connect(m_outputVolumeSlider, &DCCSlider::valueChanged, [this] (double value) { emit requestSetSpeakerVolume(value / 100.f);} ); connect(m_advancedSettingsItem, &NextPageWidget::clicked, this, &SoundWidget::requestAdvancedPage); connect(m_gsettings, &QGSettings::changed, this, &SoundWidget::onGSettingsChanged); }
bool RadeonController::start( IOService * provider ) { if (!super::start(provider)) return false; device = OSDynamicCast(IOPCIDevice, provider); if (device == NULL) return false; //get user options OSBoolean *prop; OSDictionary *dict = OSDynamicCast(OSDictionary, getProperty("UserOptions")); bzero(&options, sizeof(UserOptions)); options.HWCursorSupport = FALSE; options.enableGammaTable = FALSE; options.enableOSXI2C = FALSE; options.lowPowerMode = FALSE; if (dict) { prop = OSDynamicCast(OSBoolean, dict->getObject("enableHWCursor")); if (prop) options.HWCursorSupport = prop->getValue(); prop = OSDynamicCast(OSBoolean, dict->getObject("debugMode")); if (prop) options.debugMode = prop->getValue(); if (options.debugMode) options.HWCursorSupport = FALSE; prop = OSDynamicCast(OSBoolean, dict->getObject("enableGammaTable")); if (prop) options.enableGammaTable = prop->getValue(); prop = OSDynamicCast(OSBoolean, dict->getObject("lowPowerMode")); if (prop) options.lowPowerMode = prop->getValue(); } options.verbosity = 1; #ifdef DEBUG if (0 == getRegistryRoot()->getProperty("RadeonDumpReady")) { getRegistryRoot()->setProperty("RadeonDumpReady", kOSBooleanTrue); DumpMsg.mVerbose = 1; DumpMsg.client = 1; DumpMsg.mMsgBufferSize = 65535; if (dict) { OSNumber *optionNum; optionNum = OSDynamicCast(OSNumber, dict->getObject("verboseLevel")); if (optionNum) DumpMsg.mVerbose = optionNum->unsigned32BitValue(); optionNum = OSDynamicCast(OSNumber, dict->getObject("MsgBufferSize")); if (optionNum) DumpMsg.mMsgBufferSize = max(65535, optionNum->unsigned32BitValue()); } DumpMsg.mMsgBufferEnabled = false; DumpMsg.mMsgBufferPos = 0; DumpMsg.mMessageLock = IOLockAlloc(); DumpMsg.mMsgBuffer = (char *) IOMalloc(DumpMsg.mMsgBufferSize); if (!DumpMsg.mMsgBuffer) { IOLog("error: couldn't allocate message buffer (%ld bytes)\n", DumpMsg.mMsgBufferSize); return false; } enableMsgBuffer(true); } else DumpMsg.client += 1; options.verbosity = DumpMsg.mVerbose; #endif device->setMemoryEnable(true); IOMap = device->mapDeviceMemoryWithRegister( kIOPCIConfigBaseAddress2 ); if (IOMap == NULL) return false; FBMap = device->mapDeviceMemoryWithRegister( kIOPCIConfigBaseAddress0 ); if (FBMap == NULL) return false; memoryMap.MMIOBase = (pointer) IOMap->getVirtualAddress(); memoryMap.MMIOMapSize = IOMap->getLength(); memoryMap.FbBase = (pointer) FBMap->getVirtualAddress(); memoryMap.FbMapSize = FBMap->getLength(); memoryMap.FbPhysBase = (unsigned long)FBMap->getPhysicalAddress(); memoryMap.bitsPerPixel = 32; memoryMap.bitsPerComponent = 8; memoryMap.colorFormat = 0; //0 for non-64 bit memoryMap.BIOSCopy = NULL; memoryMap.BIOSLength = 0; IOMemoryDescriptor * mem; mem = IOMemoryDescriptor::withPhysicalAddress((IOPhysicalAddress) RHD_VBIOS_BASE, RHD_VBIOS_SIZE, kIODirectionOut); if (mem) { memoryMap.BIOSCopy = (unsigned char *)IOMalloc(RHD_VBIOS_SIZE); if (memoryMap.BIOSCopy) { mem->prepare(kIODirectionOut); if (!(memoryMap.BIOSLength = mem->readBytes(0, memoryMap.BIOSCopy, RHD_VBIOS_SIZE))) { LOG("Cannot read BIOS image\n"); memoryMap.BIOSLength = 0; } if ((unsigned int)memoryMap.BIOSLength != RHD_VBIOS_SIZE) LOG("Read only %d of %d bytes of BIOS image\n", memoryMap.BIOSLength, RHD_VBIOS_SIZE); mem->complete(kIODirectionOut); } } if (dict) { const char typeKey[2][8] = {"@0,TYPE", "@1,TYPE"}; const char EDIDKey[2][8] = {"@0,EDID", "@1,EDID"}; const char fixedModesKey[2][17] = {"@0,UseFixedModes", "@1,UseFixedModes"}; OSString *type; OSData *edidData; OSBoolean *boolData; int i; for (i = 0;i < 2;i++) { type = OSDynamicCast(OSString, dict->getObject(typeKey[i])); if (!type) continue; edidData = OSDynamicCast(OSData, dict->getObject(EDIDKey[i])); if (edidData == NULL) continue; options.EDID_Block[i] = (unsigned char *)IOMalloc(edidData->getLength()); if (options.EDID_Block[i] == NULL) continue; strncpy(options.outputTypes[i], type->getCStringNoCopy(), outputTypeLength); bcopy(edidData->getBytesNoCopy(), options.EDID_Block[i], edidData->getLength()); options.EDID_Length[i] = edidData->getLength(); boolData = OSDynamicCast(OSBoolean, dict->getObject(fixedModesKey[i])); if (boolData) options.UseFixedModes[i] = boolData->getValue(); } } xf86Screens[0] = IONew(ScrnInfoRec, 1); //using global variable, will change it later ScrnInfoPtr pScrn = xf86Screens[0]; if (pScrn == NULL) return false; bzero(pScrn, sizeof(ScrnInfoRec)); MAKE_REG_ENTRY(&nub, device); pciRec.chipType = device->configRead16(kIOPCIConfigDeviceID); pciRec.subsysVendor = device->configRead16(kIOPCIConfigSubSystemVendorID); pciRec.subsysCard = device->configRead16(kIOPCIConfigSubSystemID); pciRec.biosSize = 16; //RHD_VBIOS_SIZE = 1 << 16 pScrn->PciTag = &nub; pScrn->PciInfo = &pciRec; pScrn->options = &options; pScrn->memPhysBase = (unsigned long)FBMap->getPhysicalAddress(); pScrn->fbOffset = 0; //scanout offset pScrn->bitsPerPixel = 32; pScrn->bitsPerComponent = 8; pScrn->colorFormat = 0; pScrn->depth = pScrn->bitsPerPixel; pScrn->memoryMap = &memoryMap; createNubs(provider); setModel(device); return true; }
void IrcBufferPrivate::init(const QString& title, IrcBufferModel* m) { name = title; setModel(m); }
TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window) : QTreeView(parent) , main_window(main_window) { setUniformRowHeights(true); // Load settings bool column_loaded = loadSettings(); // Create and apply delegate listDelegate = new TransferListDelegate(this); setItemDelegate(listDelegate); // Create transfer list model listModel = new TorrentModel(this); nameFilterModel = new TransferListSortModel(); nameFilterModel->setDynamicSortFilter(true); nameFilterModel->setSourceModel(listModel); nameFilterModel->setFilterKeyColumn(TorrentModel::TR_NAME); nameFilterModel->setFilterRole(Qt::DisplayRole); nameFilterModel->setSortCaseSensitivity(Qt::CaseInsensitive); setModel(nameFilterModel); // Visual settings setRootIsDecorated(false); setAllColumnsShowFocus(true); setSortingEnabled(true); setSelectionMode(QAbstractItemView::ExtendedSelection); setItemsExpandable(false); setAutoScroll(true); setDragDropMode(QAbstractItemView::DragOnly); #if defined(Q_OS_MAC) setAttribute(Qt::WA_MacShowFocusRect, false); #endif header()->setStretchLastSection(false); // Default hidden columns if (!column_loaded) { setColumnHidden(TorrentModel::TR_ADD_DATE, true); setColumnHidden(TorrentModel::TR_SEED_DATE, true); setColumnHidden(TorrentModel::TR_UPLIMIT, true); setColumnHidden(TorrentModel::TR_DLLIMIT, true); setColumnHidden(TorrentModel::TR_TRACKER, true); setColumnHidden(TorrentModel::TR_AMOUNT_DOWNLOADED, true); setColumnHidden(TorrentModel::TR_AMOUNT_UPLOADED, true); setColumnHidden(TorrentModel::TR_AMOUNT_DOWNLOADED_SESSION, true); setColumnHidden(TorrentModel::TR_AMOUNT_UPLOADED_SESSION, true); setColumnHidden(TorrentModel::TR_AMOUNT_LEFT, true); setColumnHidden(TorrentModel::TR_TIME_ELAPSED, true); setColumnHidden(TorrentModel::TR_SAVE_PATH, true); setColumnHidden(TorrentModel::TR_COMPLETED, true); setColumnHidden(TorrentModel::TR_RATIO_LIMIT, true); setColumnHidden(TorrentModel::TR_SEEN_COMPLETE_DATE, true); setColumnHidden(TorrentModel::TR_LAST_ACTIVITY, true); setColumnHidden(TorrentModel::TR_TOTAL_SIZE, true); } //Ensure that at least one column is visible at all times bool atLeastOne = false; for (unsigned int i = 0; i<TorrentModel::NB_COLUMNS; i++) { if (!isColumnHidden(i)) { atLeastOne = true; break; } } if (!atLeastOne) setColumnHidden(TorrentModel::TR_NAME, false); //When adding/removing columns between versions some may //end up being size 0 when the new version is launched with //a conf file from the previous version. for (unsigned int i = 0; i<TorrentModel::NB_COLUMNS; i++) if ((columnWidth(i) <= 0) && (!isColumnHidden(i))) resizeColumnToContents(i); setContextMenuPolicy(Qt::CustomContextMenu); // Listen for list events connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(torrentDoubleClicked())); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(displayListMenu(const QPoint &))); header()->setContextMenuPolicy(Qt::CustomContextMenu); connect(header(), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(displayDLHoSMenu(const QPoint &))); connect(header(), SIGNAL(sectionMoved(int, int, int)), this, SLOT(saveSettings())); connect(header(), SIGNAL(sectionResized(int, int, int)), this, SLOT(saveSettings())); connect(header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSettings())); editHotkey = new QShortcut(Qt::Key_F2, this, SLOT(renameSelectedTorrent()), 0, Qt::WidgetShortcut); deleteHotkey = new QShortcut(QKeySequence::Delete, this, SLOT(softDeleteSelectedTorrents()), 0, Qt::WidgetShortcut); permDeleteHotkey = new QShortcut(Qt::SHIFT + Qt::Key_Delete, this, SLOT(permDeleteSelectedTorrents()), 0, Qt::WidgetShortcut); doubleClickHotkey = new QShortcut(Qt::Key_Return, this, SLOT(torrentDoubleClicked()), 0, Qt::WidgetShortcut); recheckHotkey = new QShortcut(Qt::CTRL + Qt::Key_R, this, SLOT(recheckSelectedTorrents()), 0, Qt::WidgetShortcut); // This hack fixes reordering of first column with Qt5. // https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777 QTableView unused; unused.setVerticalHeader(header()); header()->setParent(this); unused.setVerticalHeader(new QHeaderView(Qt::Horizontal)); }
BBTrackContainerView::BBTrackContainerView(BBTrackContainer* tc) : TrackContainerView(tc), m_bbtc(tc) { setModel( tc ); }
PacketList::PacketList(QWidget *parent) : QTreeView(parent), proto_tree_(NULL), byte_view_tab_(NULL), cap_file_(NULL), ctx_column_(-1) { QMenu *submenu, *subsubmenu; setItemsExpandable(FALSE); setRootIsDecorated(FALSE); setSortingEnabled(TRUE); setUniformRowHeights(TRUE); setAccessibleName("Packet list"); setItemDelegateForColumn(0, &related_packet_delegate_); packet_list_model_ = new PacketListModel(this, cap_file_); setModel(packet_list_model_); packet_list_model_->setColorEnabled(recent.packet_list_colorize); 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(); // " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n" ctx_menu_.addSeparator(); submenu = new QMenu(tr("Apply as Filter")); 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")); filter_actions_ << submenu->actions(); submenu = new QMenu(tr("Prepare a Filter")); 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")); filter_actions_ << submenu->actions(); submenu = new QMenu(tr("Colorize with Filter")); // " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n" // " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n" // " <menuitem name='IP' action='/Conversation Filter/IP'/>\n" // " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n" // " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n" // " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n" // " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n" // " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n" // " <menu name= 'IP' action='/Colorize Conversation/IP'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n" // " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n" // " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n" // " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n" // " <menu name= 'SCTP' action='/SCTP'>\n" // " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n" // " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n" // " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n" // " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n" // " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n" ctx_menu_.addSeparator(); // " <menu name= 'Copy' action='/Copy'>\n" submenu = new QMenu(tr("Copy")); ctx_menu_.addMenu(submenu); // " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n" // " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n" submenu->addAction(window()->findChild<QAction *>("actionEditCopyAsFilter")); filter_actions_ << window()->findChild<QAction *>("actionEditCopyAsFilter"); submenu->addSeparator(); subsubmenu = new QMenu(tr("Bytes")); submenu->addMenu(subsubmenu); // " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n" // " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n" // " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n" ctx_menu_.addSeparator(); // " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n" // " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n" ctx_menu_.addSeparator(); // " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n" // " <menuitem name='DecodeAs' action='/DecodeAs'/>\n" // " <menuitem name='Print' action='/Print'/>\n" // " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n" g_assert(gbl_cur_packet_list == NULL); gbl_cur_packet_list = this; }
/*! Called if a view is being attached to \a model. The default implementation is setting the reference of the model to the view. \sa Model::attachView() */ void AbstractView::modelAttached(Model *model) { setModel(model); }
void ProjectionFilter::update(CartesianCloud3D* cloud, double* P) { memcpy(_P, P, 12*sizeof(*_P)); setModel(cloud); }