コード例 #1
0
ファイル: tabwidget.cpp プロジェクト: fade2gray/CopyQ
void TabWidget::createTabBar()
{
    m_tabBar = new TabBar(this);
    m_toolBar->addWidget(m_tabBar);

    m_tabBar->setObjectName("tab_bar");

    m_tabBar->setExpanding(false);
    m_tabBar->setMovable(true);

    connect( m_tabBar, SIGNAL(tabMenuRequested(QPoint, int)),
             this, SIGNAL(tabMenuRequested(QPoint, int)) );
    connect( m_tabBar, SIGNAL(tabRenamed(QString,int)),
             this, SIGNAL(tabRenamed(QString,int)) );
    connect( m_tabBar, SIGNAL(tabCloseRequested(int)),
             this, SIGNAL(tabCloseRequested(int)) );
    connect( m_tabBar, SIGNAL(dropItems(QString,QMimeData)),
             this, SIGNAL(dropItems(QString,QMimeData)) );
    connect( m_tabBar, SIGNAL(currentChanged(int)),
             this, SLOT(setCurrentIndex(int)) );
    connect( m_tabBar, SIGNAL(tabMoved(int, int)),
             this, SLOT(onTabMoved(int, int)) );

    updateToolBar();
}
コード例 #2
0
ファイル: Mob.cpp プロジェクト: renaissance-da/server
bool Mob::tick(std::vector<std::function<void ()> > &deferred)
{
	//tick effects etc
	Entity::tick(deferred);
	//tick skills
	for (auto it = skills.begin(); it != skills.end(); it++) {
		it->first.decCd();
	}

	if (getHp() > 0) {
		if (++regenTick >= TICKS) {
			regenTick = 0;
			int newhp = hp + (stats.getHp() * regen) / 100;
			hp = newhp > stats.getHp() ? stats.getHp() : newhp;
		}
		ai->runAI();
		return false;
	}

	Map *m = getMap();
	Entity *e = 0;
	if (lastAttacker && (e = m->getNearByOid(this, lastAttacker)))
		DataService::getService()->groupDistributeExp(exp, level, mobId, e);

	if (spawner)
		spawner->mobDied(this);

	dropItems(e);

	deferred.push_back([=]() {
		delete this;
	});

	return true;
}
コード例 #3
0
ファイル: tabbar.cpp プロジェクト: amosbird/CopyQ
void TabBar::dropEvent(QDropEvent *event)
{
    int tabIndex = dropItemsTabIndex(*event, *this);

    if ( tabIndex != -1 )
        emit dropItems( tabName(tabIndex), event->mimeData() );
    else
        QTabBar::dropEvent(event);
}
コード例 #4
0
ファイル: square.cpp プロジェクト: Mailaender/keeperrl
void Square::onItemLands(vector<PItem> item, const Attack& attack, int remainingDist, Vec2 dir, Vision* vision) {
  dirty = true;
  if (creature) {
    item[0]->onHitCreature(creature, attack, item.size() > 1);
    if (!item[0]->isDiscarded())
      dropItems(std::move(item));
    return;
  }
  for (PTrigger& t : triggers)
    if (t->interceptsFlyingItem(item[0].get())) {
      t->onInterceptFlyingItem(std::move(item), attack, remainingDist, dir, vision);
      return;
    }

  item[0]->onHitSquareMessage(position, this, item.size() > 1);
  if (!item[0]->isDiscarded())
    dropItems(std::move(item));
}
コード例 #5
0
ファイル: fileorganiserwidget.cpp プロジェクト: A1kmm/opencor
void FileOrganiserWidget::dropItem(QStandardItem *pDropItem,
                                   const QAbstractItemView::DropIndicatorPosition &pDropPosition,
                                   QStandardItem *pNewParentItem,
                                   QStandardItem *pItem)
{
    // Drop the item as if we wanted to drop a list of items

    dropItems(pDropItem, pDropPosition, pNewParentItem,
              QList<QStandardItem *>() << pItem);
}
コード例 #6
0
void FolderListView::contentsDropEvent( QDropEvent *e )
{
QListViewItem *dest = itemAt( contentsToViewport(e->pos()) );
if ( dest && dest->rtti() == FolderListItem::ListItemType) 
	{
	emit dropItems(dest);
	e->accept();
    } 
else
	e->ignore();
}
コード例 #7
0
ファイル: xpikstestsapp.cpp プロジェクト: Ribtoks/xpiks
bool XpiksTestsApp::dropItemsForTest(const QList<QUrl> &urls) {
    SignalWaiter waiter;
    QObject::connect(&m_MetadataIOCoordinator, &MetadataIO::MetadataIOCoordinator::metadataReadingFinished,
                     &waiter, &SignalWaiter::finished);

    int addedCount = dropItems(urls);
    LOG_INFO << "Added" << addedCount << "files";

    bool success = doContinueReading(waiter);
    return success;
}
コード例 #8
0
ファイル: tabwidget.cpp プロジェクト: fade2gray/CopyQ
void TabWidget::createTabTree()
{
    m_tabTree = new TabTree(this);
    m_toolBarTree->addWidget(m_tabTree);

    m_tabTree->setObjectName("tab_tree");

    connect( m_tabTree, SIGNAL(tabMenuRequested(QPoint,QString)),
             this, SIGNAL(tabMenuRequested(QPoint,QString)) );
    connect( m_tabTree, SIGNAL(tabMoved(QString,QString,QString)),
             this, SIGNAL(tabMoved(QString,QString,QString)) );
    connect( m_tabTree, SIGNAL(dropItems(QString,QMimeData)),
             this, SIGNAL(dropItems(QString,QMimeData)) );
    connect( m_tabTree, SIGNAL(currentTabChanged(int)),
             this, SLOT(setCurrentIndex(int)) );

    updateToolBar();

    // Override left and right keys of tab tree.
    addTabAction(m_tabTree, Qt::Key_Left, this, SLOT(previousTab()), Qt::WidgetShortcut);
    addTabAction(m_tabTree, Qt::Key_Right, this, SLOT(nextTab()), Qt::WidgetShortcut);
}
コード例 #9
0
ファイル: fileorganiserwidget.cpp プロジェクト: A1kmm/opencor
void FileOrganiserWidget::moveItem(QStandardItem *pItem,
                                   QStandardItem *pDropItem,
                                   const QAbstractItemView::DropIndicatorPosition &pDropPosition)
{
    if (!pDropItem)
        // pDropItem is not valid, so...

        return;

    // Move pItem above/on/below pDropItem, depending on the drop position, but
    // first, determine the item that will own pItem

    QStandardItem *crtParentItem = pItem->parent()?
                                       pItem->parent():
                                       mModel->invisibleRootItem();
    QStandardItem *newParentItem = parentItem(pDropItem, pDropPosition);

    // Second, check whether the (file) item points to a file which is already
    // owned by newParentItem

    bool fileAlreadyOwned = false;

    if (!pItem->data(Item::Folder).toBool())
        // The current item is a file item, so retrieve its file name and check
        // whether it's already owned by newParentItem

        fileAlreadyOwned = ownedBy(pItem->data(Item::Path).toString(), newParentItem);

    // Third, move pItem to newParentItem and this to the right place, depending
    // on the value of pDropPosition and only if the destination doesn't already
    // have that item (should it be a file item, since folder items are always
    // moved)

    if (!fileAlreadyOwned || (crtParentItem == newParentItem)) {
        // Either newParentItem doesn't already own an item which points to the
        // same file as pItem or pItem's current parent is the same as
        // newParentItem in which case it means that we want to move the item
        // within its current location

        // First, check whether the item is a folder and, if so, whether it's
        // expanded (and the same with any (in)direct child folder it may
        // contain)

        backupExpandedInformation(pItem);

        // Second, move the item (and any of its children)

        dropItems(pDropItem, pDropPosition, newParentItem,
                  crtParentItem->takeRow(pItem->row()));

        // Third, re-expand folders, if necessary

        restoreExpandedInformation(pItem);

        // Fourth, resize the widget, just in case the new location of the
        // item(s) requires more space than is visible

        resizeToContents();
    } else {
        // A (file) item pointing to the same file is already owned by
        // newParentItem, so just remove the item rather than move it

        crtParentItem->removeRow(pItem->row());
    }
}