Пример #1
0
void QMJsonObject::insert(const QString &key, const QMPointer<QMJsonValue> &value, QMJsonReplacementPolicy policy)
{
    if (key.isEmpty() == true)
        return;

    auto iter = mHash.find(key);

    if (iter != mHash.end())
    {
        switch (policy)
        {
            case QMJsonReplacementPolicy_Replace:
                this->erase(iter);
                break;

            case QMJsonReplacementPolicy_Ignore:
                return;
        };
    }

    if (value.isNull() == true)
    {
        auto newValue = QMPointer<QMJsonValue>(new QMJsonValue);

        mHash.insert(key, newValue);
        emit itemAdded(key, newValue);
    }
    else
    {
        mHash.insert(key, value);
        emit itemAdded(key, value);
    }
}
Пример #2
0
void Scene::addGroup(LayerGroup *group, bool isVisible, int before)
{
	if(group == NULL)
		return;
	if(indexOfGroup(group) != -1)
		return; // Already added

	if(before < 0) {
		// Position is relative to the right
		before += m_groups.count() + 1;
	}
	before = qBound(0, before, m_groups.count());

	// Was the group previously shared?
	bool wasShared = group->isShared();

	GroupInfo info;
	info.group = group;
	info.sceneItem = new SceneItem(this, group);
	info.isVisible = isVisible;
	m_groups.insert(before, info);

	if(m_isVisible && isVisible)
		group->refVisible();

	// Create scene items for child layers. Must be done completely before
	// emitting any signals to prevent crashes
	const LayerList &layers = group->getLayers();
	for(int i = 0; i < layers.size(); i++) {
		Layer *layer = layers.at(i);
		m_layerSceneItems[layer] = new SceneItem(this, layer);
	}

	// Connect to group signals so we know when to update our scene items
	connect(group, &LayerGroup::groupChanged,
		this, &Scene::groupChanged);
	connect(group, &LayerGroup::layerAdded,
		this, &Scene::layerAdded);
	connect(group, &LayerGroup::destroyingLayer,
		this, &Scene::destroyingLayer);
	connect(group, &LayerGroup::layerMoved,
		this, &Scene::layerMoved);
	connect(group, &LayerGroup::layerChanged,
		this, &Scene::layerChanged);

	// We must emit signals after we have added everything to our lists
	// otherwise slots will access invalid data
	emit itemAdded(info.sceneItem);
	for(int i = 0; i < layers.size(); i++) {
		Layer *layer = layers.at(i);
		emit itemAdded(m_layerSceneItems[layer]);
	}

	// If the group has changed shared state then emit a changed signal
	if(wasShared != group->isShared())
		group->groupChanged(group); // Remote emit
}
QgsAppLegendInterface::QgsAppLegendInterface( QgsLegend * legend )
    : mLegend( legend )
{
  connect( legend, SIGNAL( itemAdded( QModelIndex ) ), this, SIGNAL( itemAdded( QModelIndex ) ) );
  connect( legend, SIGNAL( itemMoved( QModelIndex, QModelIndex ) ), this, SLOT( updateIndex( QModelIndex, QModelIndex ) ) );
  connect( legend, SIGNAL( itemMoved( QModelIndex, QModelIndex ) ), this, SIGNAL( groupRelationsChanged( ) ) );
  connect( legend, SIGNAL( itemMovedGroup( QgsLegendItem *, int ) ), this, SIGNAL( groupRelationsChanged() ) );
  // connect( legend, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ), this, SIGNAL( groupRelationsChanged() ) );
  connect( legend, SIGNAL( itemRemoved() ), this, SIGNAL( itemRemoved() ) );
}
Пример #4
0
void MyXmppClient::initRosterManager() {
  rosterManager = &xmppClient->rosterManager();

  qDebug() << "MyXmppClient::clientStateChanged(): initializing roster manager";

  QObject::connect( rosterManager, SIGNAL(presenceChanged(QString,QString)), this, SLOT(initPresence(const QString, const QString)), Qt::UniqueConnection );
  QObject::connect( rosterManager, SIGNAL(rosterReceived()), this, SLOT(initRoster()), Qt::UniqueConnection );
  QObject::connect( rosterManager, SIGNAL(subscriptionReceived(QString)), this, SLOT(notifyNewSubscription(QString)), Qt::UniqueConnection );
  QObject::connect( rosterManager, SIGNAL(itemAdded(QString)), this, SLOT(itemAdded(QString)), Qt::UniqueConnection );
  QObject::connect( rosterManager, SIGNAL(itemRemoved(QString)), this, SLOT(itemRemoved(QString)), Qt::UniqueConnection );
  QObject::connect( rosterManager, SIGNAL(itemChanged(QString)), this, SLOT(itemChanged(QString)), Qt::UniqueConnection );
}
Пример #5
0
//Toggle to automatically expand all items when new item added
void BC_Bulletin::autoExpand()
{
    if(ui->pushButton_4->isChecked())
    {
        connect(this, SIGNAL(itemAdded()), ui->tx, SLOT(expandAll()));
        connect(this, SIGNAL(itemAdded()), ui->fsw, SLOT(expandAll()));
    }
    else
    {
        disconnect(this, SIGNAL(itemAdded()), ui->tx, SLOT(expandAll()));
        disconnect(this, SIGNAL(itemAdded()), ui->fsw, SLOT(expandAll()));
    }
}
Пример #6
0
//Toggle to automatically scroll to bottom when new item added
void BC_Bulletin::autoScroll()
{
    if (ui->pushButton_3->isChecked())
    {
        connect(this, SIGNAL(itemAdded()), ui->tx, SLOT(scrollToBottom()));
        connect(this, SIGNAL(itemAdded()), ui->fsw, SLOT(scrollToBottom()));
    }
    else
    {
        disconnect(this, SIGNAL(itemAdded()), ui->tx, SLOT(scrollToBottom()));
        disconnect(this, SIGNAL(itemAdded()), ui->fsw, SLOT(scrollToBottom()));
    }
}
Пример #7
0
void btQVariantListWidget::insertItem()
{
    QListWidgetItem * item = new QListWidgetItem("New Item");
    item->setFlags(returnItemFlags());
    listWidget->addItem(item);
    emit itemAdded(item);
}
Пример #8
0
void MusicFileList::buildMusicList()
{
    QDir musicDir(parentFolder);
    QStringList filters;
    filters //MPEG 1 Layer III (LibMAD)
            << "*.mp3"
            //OGG Vorbis and FLAC (LibOGG, LibVorbis, LibFLAC)
            << "*.ogg" << "*.flac"
            //Uncompressed audio data
            << "*.wav" << "*.voc" << "*.aiff"
            //MIDI
            << "*.mid"
            //MikMod (Modules)
            << "*.mod" << "*.it" << "*.s3m" << "*.669" << "*.med" << "*.xm" << "*.amf"
            << "*.apun" << "*.dsm" << "*.far" << "*.gdm" << "*.imf" << "*.mtm"
            << "*.okt" << "*.stm" << "*.stx" << "*.ult" << "*.uni"
            //GAME EMU
            << "*.ay" << "*.gbs"<<"*.gym"<<"*.hes"<<"*.kss"<<"*.nsf"<<"*.nsfe"<<"*.sap"<<"*.spc"<<"*.vgm"<<"*.vgz";

    musicDir.setSorting(QDir::Name);
    musicDir.setNameFilters(filters);
    QDirIterator dirsList(parentFolder, filters,
                          QDir::Files|QDir::NoSymLinks|QDir::NoDotAndDotDot,
                          QDirIterator::Subdirectories);
    while(dirsList.hasNext())
    {
        dirsList.next();
        emit itemAdded(musicDir.relativeFilePath(dirsList.filePath()));
        if(fileWalker.isCanceled()) break;
    }
}
Пример #9
0
void QKeyList::contextMenuEvent(QContextMenuEvent* evt)
{
    QMenu menu(this);
    QAction* addObjItem = menu.addAction(tr("Add Object"));
    QAction* delObjItem = menu.addAction(tr("Remove Object"));

    if (currentItem() == NULL)
        delObjItem->setEnabled(false);

    QAction* sel = menu.exec(evt->globalPos());
    if (sel == addObjItem) {
        QFindKeyDialog dlg(this);
        if (fKeys.size() > 0)
            dlg.init(PrpShopMain::ResManager(), fKeys.back()->getLocation(),
                     fKeys.back()->getType());
        else
            dlg.init(PrpShopMain::ResManager(), fContainer->getLocation());
        if (dlg.exec() == QDialog::Accepted) {
            addKey(dlg.selection());
            emit itemAdded(dlg.selection());
        }
    } else if (sel == delObjItem) {
        int idx = indexOfTopLevelItem(currentItem());
        delItem(idx);
        emit itemRemoved(idx);
    }
}
Пример #10
0
void QgsAddRemoveItemCommand::switchState()
{
  if ( mState == Added )
  {
    // Remove
    if ( mComposition )
    {
      mComposition->itemsModel()->setItemRemoved( mItem );
      mComposition->removeItem( mItem );
    }
    emit itemRemoved( mItem );
    mState = Removed;
  }
  else //Removed
  {
    // Add
    if ( mComposition )
    {
      mComposition->itemsModel()->setItemRestored( mItem );
      mComposition->addItem( mItem );
    }
    emit itemAdded( mItem );
    mState = Added;
  }
  mComposition->project()->setDirty( true );
}
Пример #11
0
void OSObjectListCBDS::onObjectAdded(const WorkspaceObject & workspaceObject)
{
  if(std::find(m_types.begin(),m_types.end(),workspaceObject.cast<model::ModelObject>().iddObjectType()) != m_types.end())
  {
    m_workspaceObjects << workspaceObject;

    connect(workspaceObject.getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onChange, this, &OSObjectListCBDS::onObjectChanged);
    if( m_allowEmptySelection )
    {
      emit itemAdded(m_workspaceObjects.size());
    }
    else
    {
      emit itemAdded(m_workspaceObjects.size() - 1);
    }
  }
}
DockManagerNotificationBackend::DockManagerNotificationBackend(QObject* parent)
    : AbstractNotificationBackend(parent)
    , _bus(QDBusConnection::sessionBus())
{
    NotificationSettings notificationSettings;
    _enabled = notificationSettings.value("DockManager/Enabled", false).toBool();

    notificationSettings.notify("DockManager/Enabled", this, &DockManagerNotificationBackend::enabledChanged);

    _dock = new QDBusInterface("net.launchpad.DockManager", "/net/launchpad/DockManager", "net.launchpad.DockManager", _bus, this);
    if (_dock->isValid()) {
        _bus.connect("net.launchpad.DockManager",
                     "/net/launchpad/DockManager",
                     "net.launchpad.DockManager",
                     "ItemAdded",
                     this,
                     SLOT(itemAdded(QDBusObjectPath)));
    }
    else {
        // evil implementations (awn) use fd.o
        _dock = new QDBusInterface("org.freedesktop.DockManager", "/org/freedesktop/DockManager", "org.freedesktop.DockManager", _bus, this);
        if (_dock->isValid()) {
            _bus.connect("org.freedesktop.DockManager",
                         "/org/freedesktop/DockManager",
                         "org.freedesktop.DockManager",
                         "ItemAdded",
                         this,
                         SLOT(itemAdded(QDBusObjectPath)));
        }
        else {
            _available = _enabled = false;
            return;
        }
    }
    _available = true;

    itemAdded(QDBusObjectPath());

    connect(Client::coreConnection(),
            &CoreConnection::progressValueChanged,
            this,
            selectOverload<int>(&DockManagerNotificationBackend::updateProgress));
    connect(Client::coreConnection(), &CoreConnection::synchronized, this, &DockManagerNotificationBackend::synchronized);
}
Пример #13
0
void ButtonWithMenu::addItem(const Item &item)
{
    m_items.append(item);

    if (m_items.count() == 1) {
        setCurrentItem(item);
    }

    emit itemAdded(item);
}
Пример #14
0
	void VLCWrapper::addRow (const QString& location)
	{
		libvlc_media_t *m = libvlc_media_new_path (Instance_.get (),
				location.toUtf8 ());

		if (!libvlc_media_list_add_media (List_.get (), m))
			emit itemAdded (GetItemMeta (RowCount () - 1, location), location);
		else
			libvlc_media_release (m);
	}
Пример #15
0
void ItemList::add(Item* item) {
	CHECK_PARAM_RET(item != NULL);
	CHECK_PARAM_RET(!contains(item));
	CHECK_PARAM_RET(!contains(item->itemId()));
	//CHECK_PARAM_RET(item->parent() == m_proj);

	m_items.insert(item);
	m_map.insert(item->itemId(), item);
	emit itemAdded(item->itemId());
}
Пример #16
0
void QObjectListModel::insertItem(int index, QObject *item)
{
    beginInsertRows(QModelIndex(), index, index);
    _list->insert(index, item);
    connect(item, SIGNAL(destroyed()), this, SLOT(removeDestroyedItem()));
    endInsertRows();

    emit itemAdded(item);
    emit itemCountChanged();
}
Пример #17
0
void QObjectListModel::addItem(QObject *item)
{
    int z = _list->count();
    beginInsertRows(QModelIndex(), z, z);
    _list->append(item);
    connect(item, SIGNAL(destroyed()), this, SLOT(removeDestroyedItem()));
    endInsertRows();

    emit itemAdded(item);
    emit itemCountChanged();
}
Пример #18
0
void GengridItemBase::Prepend(Evas_Object *_gengrid)
{
        gengrid = _gengrid;
        item = elm_gengrid_item_prepend(gengrid,
                                        &item_class,
                                        this,
                                        _item_sel_cb, /* select function */
                                        this); /* select function data */
        elm_object_item_data_set(item, this);
        itemAdded();
}
Пример #19
0
MusicFileList::MusicFileList(QString Folder, QString current, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MusicFileList)
{
    parentFolder=Folder;
    lastCurrentFile=current;

    ui->setupUi(this);
    connect(this, SIGNAL(itemAdded(QString)), this, SLOT(addItem(QString)));
    fileWalker = QtConcurrent::run(this, &MusicFileList::buildMusicList);
}
Пример #20
0
void QgsBillBoardRegistry::addItem( void* parent, const QImage &image, const QgsPoint &worldPos , const QString &layerId )
{
  QMap<void*, QgsBillBoardItem*>::iterator it = mItems.find( parent );
  if ( it == mItems.end() )
  {
    it = mItems.insert( parent, new QgsBillBoardItem );
  }
  it.value()->image = image;
  it.value()->worldPos = worldPos;
  it.value()->layerId = layerId;
  emit itemAdded( it.value() );
}
Пример #21
0
void GengridItemBase::InsertAfter(Evas_Object *_gengrid, GengridItemBase *after)
{
        gengrid = _gengrid;
        item = elm_gengrid_item_insert_after(gengrid,
                                             &item_class,
                                             this,
                                             after->item,
                                             _item_sel_cb, /* select function */
                                             this); /* select function data */
        elm_object_item_data_set(item, this);
        itemAdded();
}
Пример #22
0
void GengridItemBase::InsertBefore(Evas_Object *_gengrid, GengridItemBase *before)
{
        gengrid = _gengrid;
        item = elm_gengrid_item_insert_before(gengrid,
                                              &item_class,
                                              this,
                                              before->item,
                                              _item_sel_cb, /* select function */
                                              this); /* select function data */
        elm_object_item_data_set(item, this);
        itemAdded();
}
Пример #23
0
void WBorderLayout::add(std::unique_ptr<WLayoutItem> item,
			LayoutPosition position)
{
  auto& it = itemAtPosition(position);
  if (it.item_) {
    LOG_ERROR("supports only one widget per position");
    return;
  }

  it.item_ = std::move(item);
  itemAdded(it.item_.get());
}
Пример #24
0
void GenlistItemBase::Prepend(Evas_Object *_genlist, GenlistItemBase *gparent)
{
    genlist = _genlist;
    item = elm_genlist_item_prepend(genlist,
                                    &item_class,
                                    this,
                                    (gparent)?gparent->item:NULL, /* parent item */
                                    flags,
                                    _item_sel_cb, /* select function */
                                    this); /* select function data */
    elm_object_item_data_set(item, this);
    itemAdded();
}
Пример #25
0
FeedListWidget::FeedListWidget(QWidget *parent, const RssManagerPtr& rssmanager): QTreeWidget(parent), m_rssManager(rssmanager) {
  setContextMenuPolicy(Qt::CustomContextMenu);
  setDragDropMode(QAbstractItemView::InternalMove);
  setSelectionMode(QAbstractItemView::ExtendedSelection);
  setColumnCount(1);
  headerItem()->setText(0, tr("RSS feeds"));
  m_unreadStickyItem = new QTreeWidgetItem(this);
  m_unreadStickyItem->setText(0, tr("Unread") + QString::fromUtf8("  (") + QString::number(rssmanager->unreadCount(), 10)+ QString(")"));
  m_unreadStickyItem->setData(0,Qt::DecorationRole, IconProvider::instance()->getIcon("mail-folder-inbox"));
  itemAdded(m_unreadStickyItem, rssmanager);
  connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(updateCurrentFeed(QTreeWidgetItem*)));
  setCurrentItem(m_unreadStickyItem);
}
Пример #26
0
bool SqlHistory::init(PluginSystemInterface *plugin_system)
{
    PluginInterface::init(plugin_system);
    m_engine = new SqlHistoryNamespace::SqlEngine;
    if(!plugin_system->setLayerInterface(HistoryLayer, m_engine))
    {
        delete m_engine;
        m_engine = 0;
        return false;
    }
    plugin_system->registerEventHandler("Core/ContactList/ItemAdded", this, SLOT(itemAdded(TreeModelItem,QString)));
    return true;
}
Пример #27
0
bool ItemDocument::registerItem(QCanvasItem *qcanvasItem) {
	if (!qcanvasItem) return false;

	requestEvent(ItemDocument::ItemDocumentEvent::ResizeCanvasToItems);

	if (Item *item = dynamic_cast<Item*>(qcanvasItem)) {
		m_itemList[item->id()] = item;
		connect(item, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
		itemAdded(item);
		return true;
	}

	return false;
}
Пример #28
0
void GenlistItemBase::InsertBefore(Evas_Object *_genlist, GenlistItemBase *before, GenlistItemBase *gparent)
{
    genlist = _genlist;
    item = elm_genlist_item_insert_before(genlist,
                                          &item_class,
                                          this,
                                          (gparent)?gparent->item:NULL, /* parent item */
                                          before->item,
                                          flags,
                                          _item_sel_cb, /* select function */
                                          this); /* select function data */
    elm_object_item_data_set(item, this);
    itemAdded();
}
Пример #29
0
void WindowModel::addItem(int id)
{
    if (!m_complete)
        return;

    LipstickCompositor *c = LipstickCompositor::instance();
    LipstickCompositorWindow *window = static_cast<LipstickCompositorWindow *>(c->windowForId(id));
    if (!approveWindow(window))
        return;

    beginInsertRows(QModelIndex(), m_items.count(), m_items.count());
    m_items.append(id);
    endInsertRows();
    emit itemAdded(m_items.count() - 1);
    emit itemCountChanged();
}
int Velasquez::EditorScene::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QGraphicsScene::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: cleared(); break;
        case 1: backgroundColorChanged((*reinterpret_cast< const QColor(*)>(_a[1]))); break;
        case 2: itemAdded((*reinterpret_cast< QGraphicsItem*(*)>(_a[1]))); break;
        case 3: itemRemoved((*reinterpret_cast< QGraphicsItem*(*)>(_a[1]))); break;
        case 4: onSelectionChanged(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}