bool QFile::open( int m ) { if ( isOpen() ) { // file already open #if defined(QT_CHECK_STATE) qWarning( "QFile::open: File already open" ); #endif return FALSE; } if ( fn.isEmpty() ) { // no file name defined #if defined(QT_CHECK_NULL) qWarning( "QFile::open: No file name specified" ); #endif return FALSE; } init(); // reset params setMode( m ); if ( !(isReadable() || isWritable()) ) { #if defined(QT_CHECK_RANGE) qWarning( "QFile::open: File access not specified" ); #endif return FALSE; } bool ok = TRUE; struct stat st; if ( isRaw() ) { int oflags = O_RDONLY; if ( isReadable() && isWritable() ) oflags = O_RDWR; else if ( isWritable() ) oflags = O_WRONLY; if ( flags() & IO_Append ) { // append to end of file? if ( flags() & IO_Truncate ) oflags |= (O_CREAT | O_TRUNC); else oflags |= (O_APPEND | O_CREAT); setFlags( flags() | IO_WriteOnly ); // append implies write } else if ( isWritable() ) { // create/trunc if writable if ( flags() & IO_Truncate ) oflags |= (O_CREAT | O_TRUNC); else oflags |= O_CREAT; } #if defined(HAS_TEXT_FILEMODE) if ( isTranslated() ) oflags |= OPEN_TEXT; else oflags |= OPEN_BINARY; #endif #if defined(HAS_ASYNC_FILEMODE) if ( isAsynchronous() ) oflags |= OPEN_ASYNC; #endif fd = qt_open( QFile::encodeName(fn), oflags, 0666 ); if ( fd != -1 ) { // open successful ::fstat( fd, &st ); // get the stat for later usage } else { ok = FALSE; } } else { // buffered file I/O QCString perm; char perm2[4]; bool try_create = FALSE; if ( flags() & IO_Append ) { // append to end of file? setFlags( flags() | IO_WriteOnly ); // append implies write perm = isReadable() ? "a+" : "a"; } else { if ( isReadWrite() ) { if ( flags() & IO_Truncate ) { perm = "w+"; } else { perm = "r+"; try_create = TRUE; // try to create if not exists } } else if ( isReadable() ) { perm = "r"; } else if ( isWritable() ) { perm = "w"; } } qstrcpy( perm2, perm ); #if defined(HAS_TEXT_FILEMODE) if ( isTranslated() ) strcat( perm2, "t" ); else strcat( perm2, "b" ); #endif for (;;) { // At most twice fh = fopen( QFile::encodeName(fn), perm2 ); if ( !fh && try_create ) { perm2[0] = 'w'; // try "w+" instead of "r+" try_create = FALSE; } else { break; } } if ( fh ) { ::fstat( fileno(fh), &st ); // get the stat for later usage } else { ok = FALSE; } } if ( ok ) { setState( IO_Open ); // on successful open the file stat was got; now test what type // of file we have if ( (st.st_mode & S_IFMT) != S_IFREG ) { // non-seekable setType( IO_Sequential ); length = INT_MAX; ioIndex = 0; } else { #if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_QT4) length = st.st_size > UINT_MAX ? UINT_MAX : (Offset)st.st_size; #else length = (Offset)st.st_size; #endif ioIndex = (flags() & IO_Append) == 0 ? 0 : length; if ( !(flags()&IO_Truncate) && length == 0 && isReadable() ) { // try if you can read from it (if you can, it's a sequential // device; e.g. a file in the /proc filesystem) int c = getch(); if ( c != -1 ) { ungetch(c); setType( IO_Sequential ); length = INT_MAX; ioIndex = 0; } resetStatus(); } } } else { init(); if ( errno == EMFILE ) // no more file handles/descrs setStatus( IO_ResourceError ); else setStatus( IO_OpenError ); setErrorStringErrno( errno ); } return ok; }
ContainerWidget::ContainerWidget(GuiObject *boss, int x, int y, int w, int h) : Widget(boss, x, y, w, h) { setFlags(WIDGET_ENABLED | WIDGET_CLEARBG); _type = kContainerWidget; }
void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) { // Early exit on an empty binary bucket. if (bin_bucket_size <= 1) return; if (NULL == bin_bucket) { llerrs << "unpackBinaryBucket failed. bin_bucket is NULL." << llendl; return; } // Convert the bin_bucket into a string. std::vector<char> item_buffer(bin_bucket_size+1); memcpy(&item_buffer[0], bin_bucket, bin_bucket_size); /* Flawfinder: ignore */ item_buffer[bin_bucket_size] = '\0'; std::string str(&item_buffer[0]); lldebugs << "item buffer: " << str << llendl; // Tokenize the string. typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep("|", "", boost::keep_empty_tokens); tokenizer tokens(str, sep); tokenizer::iterator iter = tokens.begin(); // Extract all values. LLUUID item_id; item_id.generate(); setUUID(item_id); LLAssetType::EType type; type = (LLAssetType::EType)(atoi((*(iter++)).c_str())); setType( type ); LLInventoryType::EType inv_type; inv_type = (LLInventoryType::EType)(atoi((*(iter++)).c_str())); setInventoryType( inv_type ); std::string name((*(iter++)).c_str()); rename( name ); LLUUID creator_id((*(iter++)).c_str()); LLUUID owner_id((*(iter++)).c_str()); LLUUID last_owner_id((*(iter++)).c_str()); LLUUID group_id((*(iter++)).c_str()); PermissionMask mask_base = strtoul((*(iter++)).c_str(), NULL, 16); PermissionMask mask_owner = strtoul((*(iter++)).c_str(), NULL, 16); PermissionMask mask_group = strtoul((*(iter++)).c_str(), NULL, 16); PermissionMask mask_every = strtoul((*(iter++)).c_str(), NULL, 16); PermissionMask mask_next = strtoul((*(iter++)).c_str(), NULL, 16); LLPermissions perm; perm.init(creator_id, owner_id, last_owner_id, group_id); perm.initMasks(mask_base, mask_owner, mask_group, mask_every, mask_next); setPermissions(perm); //lldebugs << "perm: " << perm << llendl; LLUUID asset_id((*(iter++)).c_str()); setAssetUUID(asset_id); std::string desc((*(iter++)).c_str()); setDescription(desc); LLSaleInfo::EForSale sale_type; sale_type = (LLSaleInfo::EForSale)(atoi((*(iter++)).c_str())); S32 price = atoi((*(iter++)).c_str()); LLSaleInfo sale_info(sale_type, price); setSaleInfo(sale_info); U32 flags = strtoul((*(iter++)).c_str(), NULL, 16); setFlags(flags); time_t now = time(NULL); setCreationDate(now); }
RadiobuttonWidget::RadiobuttonWidget(GuiObject *boss, const Common::String &name, RadiobuttonGroup *group, int value, const Common::String &label, const char *tooltip, uint8 hotkey) : ButtonWidget(boss, name, label, tooltip, 0, hotkey), _state(false), _value(value), _group(group) { setFlags(WIDGET_ENABLED); _type = kRadiobuttonWidget; _group->addButton(this); }
GraphicsWidget::GraphicsWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip) : Widget(boss, x, y, w, h, tooltip), _gfx(), _alpha(256), _transparency(false) { setFlags(WIDGET_ENABLED | WIDGET_CLEARBG); _type = kGraphicsWidget; }
void ButtonWidget::setHighLighted(bool enable) { (enable) ? setFlags(WIDGET_HILITED) : clearFlags(WIDGET_HILITED); draw(); }
PicButtonWidget::PicButtonWidget(GuiObject *boss, const Common::String &name, const char *tooltip, uint32 cmd, uint8 hotkey) : ButtonWidget(boss, name, "", tooltip, cmd, hotkey), _alpha(256), _transparency(false) { setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG); _type = kButtonWidget; }
Jump::Jump(Score* s) : Text(s) { setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE); setTextStyle(s->textStyle(TEXT_STYLE_REPEAT)); }
Marker::Marker(Score* s) : Text(s) { setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE | ELEMENT_ON_STAFF); setTextStyle(s->textStyle(TEXT_STYLE_REPEAT)); }
Node::Node(int f_number) : number(f_number), bckColor(Qt::white) { setFlags(ItemIsMovable | ItemIsSelectable | ItemSendsGeometryChanges); }
BlackEdgeTextItem::BlackEdgeTextItem() :skip(0), color(Qt::black), outline(0) { setFlags(ItemIsMovable | ItemIsFocusable); }
Path::Path(QGraphicsObject *parent) : QGraphicsObject(parent){ dr = 5; setFlags(ItemIsSelectable|ItemIsMovable); }
VideoNode::VideoNode() : QSGGeometryNode() { setFlags(OwnsGeometry | OwnsMaterial, true); setMaterialTypeSolidBlack(); }
/** * Helper function to create new item for Diagnosis table. * @return Created and initialized item with text */ QTableWidgetItem* MuonSequentialFitDialog::createTableWidgetItem(const QString& text) { auto newItem = new QTableWidgetItem(text); newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable); return newItem; }
void Widget::setVisible(bool e) { if (e) clearFlags(WIDGET_INVISIBLE); else setFlags(WIDGET_INVISIBLE); }
void UserActionElementSet::setFlags(Node* node, unsigned flags) { if (!node->isElementNode()) return; return setFlags(toElement(node), flags); }
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, Graphics::TextAlign align, const char *tooltip) : Widget(boss, x, y, w, h, tooltip), _align(align) { setFlags(WIDGET_ENABLED); _type = kStaticTextWidget; _label = text; }
KeyFrameItem::KeyFrameItem() { setPixmap(QPixmap(s_keyFramePixmap)); setFlags(ItemIsMovable); setCacheMode(DeviceCoordinateCache); }
void ButtonWidget::setPressedState() { wantTickle(true); setFlags(WIDGET_PRESSED); draw(); }
KonqProfileDlg::KonqProfileItem::KonqProfileItem( KListWidget *parent, const QString & text ) : QListWidgetItem( text, parent ), m_profileName( text ) { setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); }
CheckboxWidget::CheckboxWidget(GuiObject *boss, const Common::String &name, const Common::String &label, const char *tooltip, uint32 cmd, uint8 hotkey) : ButtonWidget(boss, name, label, tooltip, cmd, hotkey), _state(false) { setFlags(WIDGET_ENABLED); _type = kCheckboxWidget; }
void Node::setFlags(int f) { setFlags(static_cast<NodeFlags>(f)); }
SliderWidget::SliderWidget(GuiObject *boss, const Common::String &name, const char *tooltip, uint32 cmd) : Widget(boss, name, tooltip), CommandSender(boss), _cmd(cmd), _value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false) { setFlags(WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG); _type = kSliderWidget; }
Graph::Graph(int flags) { setFlags(flags); }
GraphicsWidget::GraphicsWidget(GuiObject *boss, const Common::String &name, const char *tooltip) : Widget(boss, name, tooltip), _gfx(), _alpha(256), _transparency(false) { setFlags(WIDGET_ENABLED | WIDGET_CLEARBG); _type = kGraphicsWidget; }
KonvergoWindow::KonvergoWindow(QWindow* parent) : QQuickWindow(parent), m_debugLayer(false), m_lastScale(1.0) { // NSWindowCollectionBehaviorFullScreenPrimary is only set on OSX if Qt::WindowFullscreenButtonHint is set on the window. setFlags(flags() | Qt::WindowFullscreenButtonHint); m_infoTimer = new QTimer(this); m_infoTimer->setInterval(1000); installEventFilter(new EventFilter(this)); connect(m_infoTimer, &QTimer::timeout, this, &KonvergoWindow::updateDebugInfo); InputComponent::Get().registerHostCommand("close", this, "close"); InputComponent::Get().registerHostCommand("toggleDebug", this, "toggleDebug"); InputComponent::Get().registerHostCommand("reload", this, "reloadWeb"); InputComponent::Get().registerHostCommand("fullscreen", this, "toggleFullscreen"); #ifdef TARGET_RPI // On RPI, we use dispmanx layering - the video is on a layer below Konvergo, // and during playback the Konvergo window is partially transparent. The OSD // will be visible on top of the video as part of the Konvergo window. setColor(QColor("transparent")); #else setColor(QColor("#111111")); #endif loadGeometry(); m_lastScale = CalculateScale(size()); connect(SettingsComponent::Get().getSection(SETTINGS_SECTION_MAIN), &SettingsSection::valuesUpdated, this, &KonvergoWindow::updateMainSectionSettings); connect(this, &KonvergoWindow::visibilityChanged, this, &KonvergoWindow::onVisibilityChanged); connect(this, &KonvergoWindow::enableVideoWindowSignal, this, &KonvergoWindow::enableVideoWindow, Qt::QueuedConnection); // connect(QGuiApplication::desktop(), &QDesktopWidget::screenCountChanged, // this, &KonvergoWindow::onScreenCountChanged); connect(&PlayerComponent::Get(), &PlayerComponent::windowVisible, this, &KonvergoWindow::playerWindowVisible); connect(&PlayerComponent::Get(), &PlayerComponent::playbackStarting, this, &KonvergoWindow::playerPlaybackStarting); // this is using old syntax because ... reasons. QQuickCloseEvent is not public class connect(this, SIGNAL(closing(QQuickCloseEvent*)), this, SLOT(closingWindow())); connect(qApp, &QCoreApplication::aboutToQuit, this, &KonvergoWindow::saveGeometry); if (!SystemComponent::Get().isOpenELEC()) { // this is such a hack. But I could not get it to enter into fullscreen // mode if I didn't trigger this after a while. // QTimer::singleShot(500, [=]() { updateFullscreenState(); }); } else { setWindowState(Qt::WindowFullScreen); } emit enableVideoWindowSignal(); }
ContainerWidget::ContainerWidget(GuiObject *boss, const Common::String &name) : Widget(boss, name) { setFlags(WIDGET_ENABLED | WIDGET_CLEARBG); _type = kContainerWidget; }
KeyhoteeMainWindow::KeyhoteeMainWindow(const TKeyhoteeApplication& mainApp) : _identities_root(nullptr), _connectionProcessor(*this, bts::application::instance()->get_profile()), _currentMailbox(nullptr), _isClosing(false) { ui = new Ui::KeyhoteeMainWindow; ui->setupUi(this); QString profileName = mainApp.getLoadedProfileName(); QString title = QString("%1 (%2)").arg(mainApp.getAppName().c_str()).arg(profileName); setWindowTitle(title); setEnabledAttachmentSaveOption(false); setEnabledDeleteOption(false); setEnabledMailActions(false); setEnabledShareContactOption(false); QString settings_file = "keyhotee_"; settings_file.append(profileName); setSettingsFile(settings_file); readSettings(); connect(ui->contacts_page, &ContactsTable::contactOpened, this, &KeyhoteeMainWindow::openContactGui); connect(ui->contacts_page, &ContactsTable::contactDeleted, this, &KeyhoteeMainWindow::deleteContactGui); #ifdef Q_OS_MAC //QMacNativeToolBar* native_toolbar = QtMacExtras::setNativeToolBar(ui->toolbar, true); ui->side_bar->setAttribute(Qt::WA_MacShowFocusRect, 0); #endif /// Q_OS_MAC setupStatusBar(); QWidget* empty = new QWidget(); empty->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); ui->toolbar->addWidget(empty); _search_edit = new QLineEdit(ui->toolbar); ui->toolbar->addWidget(_search_edit); _search_edit->setMaximumSize(QSize(150, 22) ); _search_edit->setAttribute(Qt::WA_MacShowFocusRect, 0); const char* search_style = "QLineEdit { " \ "padding-right: 20px; " \ "padding-left: 5px; " \ "background: url(:/images/search24x16.png);" \ "background-position: right;" \ "background-repeat: no-repeat;" \ "border: 1px solid gray;" \ "border-radius: 10px;}"; _search_edit->setStyleSheet(search_style); _search_edit->setPlaceholderText(tr("Search") ); QWidget* empty2 = new QWidget(); empty->resize(QSize(10, 10) ); ui->toolbar->addWidget(empty2); ui->actionEnable_Mining->setEnabled(gMiningIsPossible); ui->actionEnable_Mining->setVisible(gMiningIsPossible); ui->side_bar->setModificationsChecker (this); menuEdit = new MenuEditControl(this, ui->actionCopy, ui->actionCut, ui->actionPaste); //init ui->actionPaste onClipboardChanged(); connect(QApplication::clipboard(), &QClipboard::changed, this, &KeyhoteeMainWindow::onClipboardChanged); // ---------------------- MenuBar // File connect(ui->actionExit, &QAction::triggered, this, &KeyhoteeMainWindow::onExit); // Edit connect(ui->actionCopy, &QAction::triggered, this, &KeyhoteeMainWindow::onCopy); connect(ui->actionCut, &QAction::triggered, this, &KeyhoteeMainWindow::onCut); connect(ui->actionPaste, &QAction::triggered, this, &KeyhoteeMainWindow::onPaste); connect(ui->actionSelect_All, &QAction::triggered, this, &KeyhoteeMainWindow::onSelectAll); // Identity connect(ui->actionNew_identity, &QAction::triggered, this, &KeyhoteeMainWindow::onNewIdentity); connect(ui->actionEnable_Mining, &QAction::toggled, this, &KeyhoteeMainWindow::onEnableMining); // Mail connect(ui->actionNew_Message, &QAction::triggered, this, &KeyhoteeMainWindow::newMailMessage); connect(ui->actionSave_attachement, &QAction::triggered, this, &KeyhoteeMainWindow::onSaveAttachement); // Contact connect(ui->actionNew_Contact, &QAction::triggered, this, &KeyhoteeMainWindow::addContact); connect(ui->actionSet_Icon, &QAction::triggered, this, &KeyhoteeMainWindow::onSetIcon); connect(ui->actionShow_Contacts, &QAction::triggered, this, &KeyhoteeMainWindow::showContacts); connect(ui->actionRequest_authorization, &QAction::triggered, this, &KeyhoteeMainWindow::onRequestAuthorization); connect(ui->actionShare_contact, &QAction::triggered, this, &KeyhoteeMainWindow::onShareContact); // Help connect(ui->actionDiagnostic, &QAction::triggered, this, &KeyhoteeMainWindow::onDiagnostic); connect(ui->actionAbout, &QAction::triggered, this, &KeyhoteeMainWindow::onAbout); connect(ui->splitter, &QSplitter::splitterMoved, this, &KeyhoteeMainWindow::sideBarSplitterMoved); connect(ui->side_bar, &TreeWidgetCustom::itemSelectionChanged, this, &KeyhoteeMainWindow::onSidebarSelectionChanged); connect(ui->side_bar, &TreeWidgetCustom::itemDoubleClicked, this, &KeyhoteeMainWindow::onSidebarDoubleClicked); connect(ui->side_bar, &TreeWidgetCustom::itemContactRemoved, this, &KeyhoteeMainWindow::onItemContactRemoved); connect(ui->side_bar, &TreeWidgetCustom::itemContextAcceptRequest, this, &KeyhoteeMainWindow::onItemContextAcceptRequest); connect(ui->side_bar, &TreeWidgetCustom::itemContextDenyRequest, this, &KeyhoteeMainWindow::onItemContextDenyRequest); connect(ui->side_bar, &TreeWidgetCustom::itemContextBlockRequest, this, &KeyhoteeMainWindow::onItemContextBlockRequest); //connect( _search_edit, SIGNAL(textChanged(QString)), this, SLOT(searchEditChanged(QString)) ); connect(_search_edit, &QLineEdit::textChanged, this, &KeyhoteeMainWindow::searchEditChanged); auto space2 = ui->side_bar->topLevelItem(TopLevelItemIndexes::Space2); auto space3 = ui->side_bar->topLevelItem(TopLevelItemIndexes::Space3); auto space_flags = space2->flags() & (~Qt::ItemFlags(Qt::ItemIsSelectable) ); space_flags |= Qt::ItemNeverHasChildren; space2->setFlags(space_flags); space3->setFlags(space_flags); //_identities_root = ui->side_bar->topLevelItem(TopLevelItemIndexes::Identities); _mailboxes_root = ui->side_bar->topLevelItem(TopLevelItemIndexes::Mailboxes); _contacts_root = ui->side_bar->topLevelItem(TopLevelItemIndexes::Contacts); _wallets_root = ui->side_bar->topLevelItem(TopLevelItemIndexes::Wallets); _requests_root = ui->side_bar->topLevelItem(TopLevelItemIndexes::Requests); _contacts_root->setExpanded(true); _requests_root->setExpanded(true); _requests_root->setHidden(true); //_identities_root->setExpanded(true); _mailboxes_root->setExpanded(true); _inbox_root = _mailboxes_root->child(Inbox); _drafts_root = _mailboxes_root->child(Drafts); _out_box_root = _mailboxes_root->child(Outbox); _sent_root = _mailboxes_root->child(Sent); _wallets_root->setExpanded(true); _bitcoin_root = _wallets_root->child(Bitcoin); _bitshares_root = _wallets_root->child(BitShares); _litecoin_root = _wallets_root->child(Litecoin); auto app = bts::application::instance(); auto profile = app->get_profile(); auto idents = profile->identities(); auto addressbook = profile->get_addressbook(); _addressbook_model = new AddressBookModel(this, addressbook); _inbox_model = new MailboxModel(this, profile, profile->get_inbox_db(), *_addressbook_model, false); _draft_model = new MailboxModel(this, profile, profile->get_draft_db(), *_addressbook_model, true); _pending_model = new MailboxModel(this, profile, profile->get_pending_db(), *_addressbook_model, false); _sent_model = new MailboxModel(this, profile, profile->get_sent_db(), *_addressbook_model, false); connect(_addressbook_model, &QAbstractItemModel::dataChanged, this, &KeyhoteeMainWindow::addressBookDataChanged); ui->contacts_page->setAddressBook(_addressbook_model); ui->new_contact->setAddressBook(_addressbook_model); ui->inbox_page->initial(_connectionProcessor, _inbox_model, Mailbox::Inbox, this); ui->draft_box_page->initial(_connectionProcessor, _draft_model, Mailbox::Drafts, this); ui->out_box_page->initial(_connectionProcessor, _pending_model, Mailbox::Outbox, this); ui->sent_box_page->initial(_connectionProcessor, _sent_model, Mailbox::Sent, this); ui->widget_stack->setCurrentWidget(ui->inbox_page); ui->actionDelete->setShortcut(QKeySequence::Delete); connect(ui->actionDelete, SIGNAL(triggered()), ui->inbox_page, SLOT(onDeleteMail())); connect(ui->actionShow_details, SIGNAL(toggled(bool)), ui->inbox_page, SLOT(on_actionShow_details_toggled(bool))); connect(ui->actionReply, SIGNAL(triggered()), ui->inbox_page, SLOT(onReplyMail())); connect(ui->actionReply_all, SIGNAL(triggered()), ui->inbox_page, SLOT(onReplyAllMail())); connect(ui->actionForward, SIGNAL(triggered()), ui->inbox_page, SLOT(onForwardMail())); wlog("idents: ${idents}", ("idents", idents) ); if(isIdentityPresent() == false ) { ui->actionNew_Message->setEnabled(false); ui->actionRequest_authorization->setEnabled(false); } for (size_t i = 0; i < idents.size(); ++i) { try { app->mine_name(idents[i].dac_id_string, profile->get_keychain().get_identity_key(idents[i].dac_id_string).get_public_key(), idents[i].mining_effort); } catch ( const fc::exception& e ) { wlog( "${e}", ("e",e.to_detail_string()) ); } } app->set_mining_intensity(0); ui->actionEnable_Mining->setChecked(app->get_mining_intensity() != 0); _addressbook = profile->get_addressbook(); /* auto abook = profile->get_addressbook(); auto contacts = abook->get_known_bitnames(); for( auto itr = contacts.begin(); itr != contacts.end(); ++itr ) { auto new_contact_item = new QTreeWidgetItem(_contacts_root, (QTreeWidgetItem::ItemType)ContactItem ); auto id_rec = app->lookup_name( *itr ); if( !id_rec ) { new_contact_item->setText( 0, (*itr + " [unknown]").c_str() ); } else { new_contact_item->setText( 0, (*itr + " [" + std::to_string(id_rec->repute)+"]" ).c_str() ); } } */ QAction* actionMenu = new QAction(tr("Keyhotee"), this); actionMenu->setCheckable(true); this->setMenuWindow(ui->menuWindow); this->registration(actionMenu); actionMenu->setVisible(false); }
Document::Document() { setFlags(FLAG_RESIZABLE); }
ProcessorGraphicsItem::ProcessorGraphicsItem(Processor* processor) : ProcessorObserver() , LabelGraphicsItemObserver() , processor_(processor) , processorMeta_(nullptr) , progressItem_(nullptr) , statusItem_(nullptr) , linkItem_(nullptr) , highlight_(false) #if IVW_PROFILING , processCount_(0) , countLabel_(nullptr) , maxEvalTime_(0.0) , evalTime_(0.0) , totEvalTime_(0.0) #endif { setZValue(PROCESSORGRAPHICSITEM_DEPTH); setFlags(ItemIsMovable | ItemIsSelectable | ItemIsFocusable | ItemSendsGeometryChanges); setCacheMode(QGraphicsItem::DeviceCoordinateCache); setRect(-width / 2, -height / 2, width, height); QGraphicsDropShadowEffect* processorShadowEffect = new QGraphicsDropShadowEffect(); processorShadowEffect->setOffset(3.0); processorShadowEffect->setBlurRadius(3.0); setGraphicsEffect(processorShadowEffect); nameLabel_ = new LabelGraphicsItem(this); nameLabel_->setCrop(9, 8); nameLabel_->setPos(-width / 2.0 + labelHeight, -height / 2.0 + 0.6 * labelHeight); nameLabel_->setDefaultTextColor(Qt::white); QFont nameFont("Segoe", labelHeight, QFont::Black, false); nameFont.setPixelSize(pointSizeToPixelSize(labelHeight)); nameLabel_->setFont(nameFont); LabelGraphicsItemObserver::addObservation(nameLabel_); classLabel_ = new LabelGraphicsItem(this); classLabel_->setCrop(9, 8); classLabel_->setPos(-width / 2.0 + labelHeight, -height / 2.0 + labelHeight * 2.0); classLabel_->setDefaultTextColor(Qt::lightGray); QFont classFont("Segoe", labelHeight, QFont::Normal, true); classFont.setPixelSize(pointSizeToPixelSize(labelHeight)); classLabel_->setFont(classFont); nameLabel_->setText(QString::fromStdString(processor_->getIdentifier())); classLabel_->setText(QString::fromStdString(processor_->getDisplayName() + " " + processor_->getTags().getString())); processor_->ProcessorObservable::addObserver(this); processorMeta_ = processor->getMetaData<ProcessorMetaData>(ProcessorMetaData::CLASS_IDENTIFIER); processorMeta_->addObserver(this); linkItem_ = new ProcessorLinkGraphicsItem(this); std::vector<Inport*> inports = processor_->getInports(); std::vector<Outport*> outports = processor_->getOutports(); inportX = rect().left() + 12.5f; inportY = rect().top() + 4.5f; outportX = rect().left() + 12.5f; outportY = rect().bottom() - 4.5f; for (auto& inport : inports) { addInport(inport); } for (auto& outport : outports) { addOutport(outport); } statusItem_ = new ProcessorStatusGraphicsItem(this, processor_); if (auto progressBarOwner = dynamic_cast<ProgressBarOwner*>(processor_)) { progressItem_ = new ProcessorProgressGraphicsItem(this, &(progressBarOwner->getProgressBar())); progressBarOwner->getProgressBar().ActivityIndicator::addObserver(statusItem_); } if (auto activityInd = dynamic_cast<ActivityIndicatorOwner*>(processor_)){ activityInd->getActivityIndicator().addObserver(statusItem_); } #if IVW_PROFILING countLabel_ = new LabelGraphicsItem(this); countLabel_->setCrop(9,8); countLabel_->setPos(rect().left() + labelHeight, height / 2 - labelHeight*2.5); countLabel_->setDefaultTextColor(Qt::lightGray); countLabel_->setFont(classFont); countLabel_->setTextWidth(width - 2*labelHeight); #endif setVisible(processorMeta_->isVisible()); setSelected(processorMeta_->isSelected()); setPos(QPointF(processorMeta_->getPosition().x, processorMeta_->getPosition().y)); }