Beispiel #1
0
		void process() {
			while(nextOperation) {
				auto operation = nextOperation;
				switch(operation->type) {
				case OperationType::Add: onAdd(operation); break;
				case OperationType::Remove: onRemove(operation); break;
				case OperationType::RemoveAll: onRemoveAll(operation); break;
				default:
					throw std::runtime_error("Unexpected EntityOperation type");
				}

				nextOperation = operation->nextOperation;
				operation->~T();
				memoryManager->free(sizeof(T), alignof(T), operation);
			}
			nextOperation = nullptr;
			lastOperation = nullptr;
		}
Beispiel #2
0
void *SuperHashTable::addOrFindExact(void * donor)
{
    unsigned vm = doFindExact(donor);
    void *et = table[vm];
    if(!et)
    {
        unsigned tablelim = getTableLimit(tablesize);
        if (tablecount>=tablelim)
        {
            expand();
            vm = doFindExact(donor);
        }
        tablecount++;
        table[vm] = donor;
        onAdd(donor);
        return donor;
    }
    return et;
}
void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata)
{
    if (!isActionEnabled(userdata))
        return;

    const std::string command_name = userdata.asString();
    if (command_name == "new")
    {
        onSave();
    }
    if (command_name == "edit")
    {
        onEdit();
    }
    if (command_name == "wear")
    {
        onWearButtonClick();
    }
    // Note: This option has been removed from the gear menu.
    if (command_name == "add")
    {
        onAdd();
    }
    if (command_name == "remove")
    {
        onRemove();
    }
    if (command_name == "rename")
    {
        onClipboardAction("rename");
    }
    if (command_name == "remove_link")
    {
        onClipboardAction("delete");
    }
    if (command_name == "delete")
    {
        onClipboardAction("delete");
    }
    updateListCommands();
    updateVerbs();
}
Beispiel #4
0
void *SuperHashTable::addOrFind(void * donor)
{
    unsigned vs = getHashFromElement(donor);
    unsigned vm = doFind(vs, getFindParam(donor));
    void *et = table[vm];
    if(!et)
    {
        unsigned tablelim = getTableLimit(tablesize);
        if (tablecount>=tablelim)
        {
            expand();
            vm = doFind(vs, getFindParam(donor));
        }
        tablecount++;
        table[vm] = donor;
        onAdd(donor);
        return donor;
    } 
    return et;
}
/* QPlasmaPakFile */
QPlasmaPakFile::QPlasmaPakFile(QWidget* parent)
              : QPlasmaDocument(kDocPackage, parent)
{
    fFileList = new QTreeWidget(this);
    fFileList->setUniformRowHeights(true);
    fFileList->setRootIsDecorated(false);
    fFileList->setEditTriggers(QAbstractItemView::SelectedClicked |
                               QAbstractItemView::EditKeyPressed);
    fFileList->setContextMenuPolicy(Qt::CustomContextMenu);
    fFileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
    fFileList->setHeaderLabels(QStringList() << "Filename" << "Size");

    QToolBar* toolbar = new QToolBar(this);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
    toolbar->setIconSize(QSize(22, 22));

    QGridLayout* layout = new QGridLayout(this);
    layout->setContentsMargins(4, 4, 4, 4);
    layout->addWidget(fFileList, 0, 0);
    layout->addWidget(toolbar, 0, 1);
    setLayout(layout);

    fActions[kAdd] = new QAction(qStdIcon("list-add"), tr("&Add / Update..."), this);
    fActions[kDel] = new QAction(qStdIcon("list-remove"), tr("&Delete"), this);
    fActions[kExtract] = new QAction(qStdIcon("document-save"), tr("&Extract..."), this);
    fActions[kExtractAll] = new QAction(QIcon(":/img/pak.png"), tr("Ex&tract all..."), this);

    toolbar->addAction(fActions[kAdd]);
    toolbar->addAction(fActions[kDel]);
    toolbar->addSeparator();
    toolbar->addAction(fActions[kExtract]);
    toolbar->addAction(fActions[kExtractAll]);

    connect(fFileList, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(onContextMenu(QPoint)));
    connect(fActions[kAdd], SIGNAL(triggered()), this, SLOT(onAdd()));
    connect(fActions[kDel], SIGNAL(triggered()), this, SLOT(onDel()));
    connect(fActions[kExtract], SIGNAL(triggered()), this, SLOT(onExtract()));
    connect(fActions[kExtractAll], SIGNAL(triggered()), this, SLOT(onExtractAll()));
}
Beispiel #6
0
QPlasmaSumFile::QPlasmaSumFile(QWidget* parent)
              : QPlasmaDocument(kDocManifest, parent)
{
    fFileList = new QTreeWidget(this);
    fFileList->setUniformRowHeights(true);
    fFileList->setRootIsDecorated(false);
    fFileList->setEditTriggers(QAbstractItemView::SelectedClicked |
                               QAbstractItemView::EditKeyPressed);
    fFileList->setContextMenuPolicy(Qt::CustomContextMenu);
    fFileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
    fFileList->setHeaderLabels(QStringList() << "Filename" << "Timestamp" << "MD5");

    QToolBar* toolbar = new QToolBar(this);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
    toolbar->setIconSize(QSize(22, 22));

    QGridLayout* layout = new QGridLayout(this);
    layout->setContentsMargins(4, 4, 4, 4);
    layout->addWidget(fFileList, 0, 0);
    layout->addWidget(toolbar, 0, 1);
    setLayout(layout);

    fActions[kAUpdate] = new QAction(qStdIcon("view-refresh"), tr("&Update all..."), this);
    fActions[kAAdd] = new QAction(qStdIcon("list-add"), tr("&Add / Update..."), this);
    fActions[kADel] = new QAction(qStdIcon("list-remove"), tr("&Remove"), this);

    toolbar->addAction(fActions[kAUpdate]);
    toolbar->addSeparator();
    toolbar->addAction(fActions[kAAdd]);
    toolbar->addAction(fActions[kADel]);

    connect(fFileList, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(onContextMenu(QPoint)));
    connect(fFileList, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
            this, SLOT(onItemChanged(QTreeWidgetItem*, int)));
    connect(fActions[kAUpdate], SIGNAL(triggered()), this, SLOT(onUpdate()));
    connect(fActions[kAAdd], SIGNAL(triggered()), this, SLOT(onAdd()));
    connect(fActions[kADel], SIGNAL(triggered()), this, SLOT(onDel()));
}
Beispiel #7
0
/**
 * \brief widget, creates the Options Tab Shortcuts Widget
 * \return QWidget*, points to the previously created widget
 */
QWidget *OptionsTabShortcuts::widget()
{
	if ( w )
		return 0;

	w = new OptShortcutsUI();
	OptShortcutsUI *d = (OptShortcutsUI *)w;
	
	d->treeShortcuts->setColumnWidth(0, 320);	

	d->add->setEnabled(false);
	d->remove->setEnabled(false);
	d->edit->setEnabled(false);

	connect(d->treeShortcuts, SIGNAL(itemSelectionChanged()), this, SLOT(onItemSelectionChanged()));
	connect(d->treeShortcuts, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(onItemDoubleClicked(QTreeWidgetItem *, int)));
	connect(d->add, SIGNAL(clicked()), this, SLOT(onAdd()));
	connect(d->remove, SIGNAL(clicked()), this, SLOT(onRemove()));
	connect(d->edit, SIGNAL(clicked()), this, SLOT(onEdit()));
	connect(d->restoreDefaults, SIGNAL(clicked()), this, SLOT(onRestoreDefaults()));
	return w;
}
// internal call, for use in avoiding lookup
bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPtr pNotification)
{	
	std::string cmd = payload["sigtype"];
	LLNotificationSet::iterator foundItem = mItems.find(pNotification);
	bool wasFound = (foundItem != mItems.end());
	bool passesFilter = mFilter(pNotification);
	
	// first, we offer the result of the filter test to the simple
	// signals for pass/fail. One of these is guaranteed to be called.
	// If either signal returns true, the change processing is NOT performed
	// (so don't return true unless you know what you're doing!)
	bool abortProcessing = false;
	if (passesFilter)
	{
		abortProcessing = mPassedFilter(payload);
	}
	else
	{
		abortProcessing = mFailedFilter(payload);
	}
	
	if (abortProcessing)
	{
		return true;
	}
	
	if (cmd == "load")
	{
		// should be no reason we'd ever get a load if we already have it
		// if passes filter send a load message, else do nothing
		assert(!wasFound);
		if (passesFilter)
		{
			// not in our list, add it and say so
			mItems.insert(pNotification);
			abortProcessing = mChanged(payload);
			onLoad(pNotification);
		}
	}
	else if (cmd == "change")
	{
		// if it passes filter now and was found, we just send a change message
		// if it passes filter now and wasn't found, we have to add it
		// if it doesn't pass filter and wasn't found, we do nothing
		// if it doesn't pass filter and was found, we need to delete it
		if (passesFilter)
		{
			if (wasFound)
			{
				// it already existed, so this is a change
				// since it changed in place, all we have to do is resend the signal
				abortProcessing = mChanged(payload);
				onChange(pNotification);
			}
			else
			{
				// not in our list, add it and say so
				mItems.insert(pNotification);
				// our payload is const, so make a copy before changing it
				LLSD newpayload = payload;
				newpayload["sigtype"] = "add";
				abortProcessing = mChanged(newpayload);
				onChange(pNotification);
			}
		}
		else
		{
			if (wasFound)
			{
				// it already existed, so this is a delete
				mItems.erase(pNotification);
				// our payload is const, so make a copy before changing it
				LLSD newpayload = payload;
				newpayload["sigtype"] = "delete";
				abortProcessing = mChanged(newpayload);
				onChange(pNotification);
			}
			// didn't pass, not on our list, do nothing
		}
	}
	else if (cmd == "add")
	{
		// should be no reason we'd ever get an add if we already have it
		// if passes filter send an add message, else do nothing
		assert(!wasFound);
		if (passesFilter)
		{
			// not in our list, add it and say so
			mItems.insert(pNotification);
			abortProcessing = mChanged(payload);
			onAdd(pNotification);
		}
	}
	else if (cmd == "delete")
	{
		// if we have it in our list, pass on the delete, then delete it, else do nothing
		if (wasFound)
		{
			abortProcessing = mChanged(payload);
			mItems.erase(pNotification);
			onDelete(pNotification);
		}
	}
	return abortProcessing;
}
Beispiel #9
0
void ABoxDlg::onBmpAdd( wxMouseEvent& event ) {
  wxCommandEvent cmdEvent;
  onAdd(cmdEvent);
}
Beispiel #10
0
	
	loadName();
}

/*
 *  Destroys the object and frees any allocated resources
 */
keyDialog::~keyDialog()
{
}


void keyDialog::connectSlots()
{
	connect( ui.nameListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(onNamechange(int)) );
	connect( ui.addButton, SIGNAL(clicked()), this, SLOT(onAdd()) );
	connect( ui.deleteButton, SIGNAL(clicked()), this, SLOT(onDelete()) );
	connect( ui.updateButton, SIGNAL(clicked()), this, SLOT(onUpdate()) );
	connect( ui.closeButton, SIGNAL(clicked()), this, SLOT(onClose()) );
	connect( ui.upButton, SIGNAL(clicked()), this, SLOT(onUp()) );
	connect( ui.downButton, SIGNAL(clicked()), this, SLOT(onDown()) );
	connect( ui.leftButton, SIGNAL(clicked()), this, SLOT(onLeft()) );
	connect( ui.rightButton, SIGNAL(clicked()), this, SLOT(onRight()) );
	connect( ui.enterButton, SIGNAL(clicked()), this, SLOT(onEnter()) );
	connect( &bgKey, SIGNAL(buttonClicked(int)), this, SLOT(onSelect(int)) );
	connect( ui.scriptButton, SIGNAL(clicked()), this, SLOT(onScript()) );
	connect( ui.programButton, SIGNAL(clicked()), this, SLOT(onProgram()) );

}

void keyDialog::onNamechange( int item )
Beispiel #11
0
void MembersBox::prepare() {
	setTitle(lang(_filter == MembersFilter::Recent ? lng_channel_members : lng_channel_admins));

	_inner = setInnerWidget(object_ptr<Inner>(this, _channel, _filter), st::boxLayerScroll);

	setDimensions(st::boxWideWidth, st::boxMaxListHeight);
	addButton(lang(lng_close), [this] { closeBox(); });
	if (_channel->amCreator() && (_channel->membersCount() < (_channel->isMegagroup() ? Global::MegagroupSizeMax() : Global::ChatSizeMax()) || (!_channel->isMegagroup() && !_channel->isPublic()) || _filter == MembersFilter::Admins)) {
		addLeftButton(lang((_filter == MembersFilter::Admins) ? lng_channel_add_admin : lng_channel_add_members), [this] { onAdd(); });
	}

	connect(_inner, SIGNAL(mustScrollTo(int, int)), this, SLOT(onScrollToY(int, int)));

	_loadTimer.create(this);
	connect(_loadTimer, SIGNAL(timeout()), _inner, SLOT(load()));
}
Beispiel #12
0
void datacollector::updateData(vector<Point2f> newData,double minDist){
    if(newData.size()>0 && newData.size()<300){
        ///POPULATE DISTANCE MATIX
        for(int i=0;i<newData.size();i++){
            used[i]=false;
        }
        for(mapIt = data.begin(); mapIt != data.end( ); ++mapIt){
            int numB=0;
            for (it = newData.begin(); it!=newData.end(); ++it){
                distances[mapIt->first][numB]=distancePointPoint(Point2f(mapIt->second.x,mapIt->second.y),*it);
                numB++;
            }
        }
        ///* TO AID IN THE SEARCH *///
        map<int,Point2f> aux=data;
        bool buscar=true;
        while(buscar){
            int mI=0;
            Point2f pI(0,0);
            double dist=1000000000;
            bool hayMin=false;
            int numB=0,numU=10000000;
        for (it = newData.begin(); it!=newData.end(); ++it){
            if(!used[numB]){
           for(mapIt = aux.begin(); mapIt != aux.end( ); ++mapIt){
               if(dist>distances[mapIt->first][numB]){
                   dist=distances[mapIt->first][numB];
                   hayMin=true;
                   mI=mapIt->first;
                   pI.x=it->x;pI.y=it->y;
                   numU=numB;
               }
           }
           }
           numB++;
        }
        if(hayMin){
            used[numU]=true;
            ///UPDATE THE VALUE
            /// HERE CHANGE UPDATE ONLY IF DISTANCE IS MORE THAN...
            if(distances[mI][numU]>minDist){
                data[mI]=pI;
            }
            aux.erase(aux.find(mI));
            if(onUpdate==NULL){
            cout << "set cur " << mI << " : " << data[mI].x << "," <<  data[mI].y << endl;
            if(useMouse && mI==0){
                tmw->move(data[mI].x,data[mI].y);
            }
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////
            else{onUpdate(mI,data[mI].x,data[mI].y);}
            /////////////////////////////////////////////////////////////////////////////////////////////////////
        }
        else{
            buscar=false;
        }
        }
        for(mapIt = aux.begin(); mapIt != aux.end( ); ++mapIt ){
            //REMOVE THOSE NOT USED
            data.erase(data.find(mapIt->first));
            if(onRemove==NULL){
            cout << "del cur " << mapIt->first << endl;
            if(useMouse && mapIt->first==0){
                tmw->release();
            }
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////
            else{onRemove(mapIt->first);}
            /////////////////////////////////////////////////////////////////////////////////////////////////////
        }
        int numB=0;
        for (it = newData.begin(); it!=newData.end(); ++it){
            if(!used[numB]){
                ///CHECK FOR FREE ID AND ASSIGN THE NEW VALUE:
                for(int u=0;u<300;u++){
                    if(data.count(u)==0){
                        data[u]=Point2f(it->x,it->y);
                        if(onAdd==NULL){
                            cout << "add cur "<< u << " : " << it->x <<"," <<it->y << endl;
                            if(useMouse && u==0){
                                tmw->press(it->x,it->y);
                            }
                        }
                        /////////////////////////////////////////////////////////////////////////////////////////////////////
                        else{
                            onAdd(u,it->x,it->y);
                        }
                        /////////////////////////////////////////////////////////////////////////////////////////////////////
                        break;
                    }
                }
            }
            numB++;
        }
        //cout << "DATA SIZE : " << data.size() << endl;
    }
    else{
        if(data.size()>0){
        for(mapIt = data.begin(); mapIt != data.end( ); ++mapIt ){
            //REMOVE ALL
            if(onRemove==NULL){
            cout << "del cur " << mapIt->first << endl;
            if(useMouse && mapIt->first==0){
                tmw->release();
            }
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////
            else{onRemove(mapIt->first);}
            /////////////////////////////////////////////////////////////////////////////////////////////////////
        }
        data.clear();
        }
    }
}
Beispiel #13
0
/**
 * \brief    Emet le signal que le bouton ajouter une note existante à été clické
 */
void DocumentEditorRow::add() {
    emit onAdd(this);
}
Beispiel #14
0
void
MainWindow::onStart() {

    if ( ccliveVersion.isEmpty() ) {
        critCcliveNotSpecified(this);
        onPreferences();
        return;
    }

    if (linksList->count() == 0) {
        onAdd();
        if (linksList->count() == 0)
            return;
    }

    QString path = prefs->ccliveEdit->text();

    // Check video save directory

    // cclive has no option for this but we can work around it by
    // changing the current working directory.

    QString savedir = prefs->savedirEdit->text();
    if (savedir.isEmpty()) {
        QMessageBox::information(this, QCoreApplication::applicationName(),
            tr("Please define a directory for downloaded videos."));
        onPreferences();
        return;
    }

    process.setWorkingDirectory(savedir);

    // Construct cclive/clive args

    QStringList args;

    args << "--print-fname" << "--continue";

    QString s = prefs->streamEdit->text();
    if (!s.isEmpty() && streamBox->isChecked()) {
        args << QString("--stream-exec=%1").arg(s);
        args << QString("--stream=%1").arg(streamSpin->value());
    }

    s = prefs->commandEdit->text();
    if (!s.isEmpty() && commandBox->isChecked()) {
        if (!s.endsWith(";"))
            s += ";";
        args << QString("--exec=%1").arg(s);
        args << QString("--exec-run");
    }

    if (prefs->proxyCombo->currentIndex() == 0)
        args << "--no-proxy";
    else {
        s = prefs->proxyEdit->text();
        if (!s.isEmpty())
            args << QString("--proxy=%1").arg(s);
    }

    if (prefs->limitBox->checkState()) {
        int n = prefs->limitSpin->value();
        args << QString("--limit-rate=%1").arg(n);
    }

    if (prefs->timeoutBox->checkState()) {
        int n = prefs->timeoutSpin->value();
        if (!prefs->socksBox->checkState())
            args << QString("--connect-timeout=%1").arg(n);
        else
            args << QString("--connect-timeout-socks=%1").arg(n);
    }

    QStringList env;

    if (isCcliveFlag) {
        s = regexpEdit->text();
        if (!s.isEmpty())
            args << QString("--regexp=%1").arg(s);
        s = substEdit->text();
        if (!s.isEmpty())
            args << QString("--substitute=%1").arg(s);
    } else {

        args << "--stderr";

        // Set environment variables for clive
        env  << "COLUMNS=80" << "LINES=24"               // Term::ReadKey
             << QString("HOME=%1").arg(QDir::homePath()) // $env{HOME}
             << "CCLIVE_NO_CONFIG=1";                    // cclive 0.5.0+

        s = cclassEdit->text();
        if (!s.isEmpty())
            args << QString("--cclass=%1").arg(s);
    }

    s = fnamefmtEdit->text();
    if (!s.isEmpty())
        args << QString("--filename-format=%1").arg(s);

    // Check if all video page links are of the same host.

    QUrl first(linksList->item(0)->text());

    bool allSame    = true;
    const register _uint count = linksList->count();

    for (register _uint i=0; i<count; ++i) {

        QUrl url(linksList->item(i)->text());

        if (url.host() != first.host()) {
            allSame = false;
            break;
        }
    }

    s = "flv";

    // Use format dialog setting for the host.
    if (allSame)
        s = format->getFormatSetting(first.host());

    args << QString("--format=%1").arg(s);

    for (register _uint i=0; i<count; ++i)
        args << QString("%1").arg(linksList->item(i)->text());

    totalProgressbar->setMaximum(linksList->count());

    // Prepare log

    logEdit->clear();
    Util::appendLog(logEdit, "% " +path+ " " +args.join(" "));

    // And finally start the process

    cancelledFlag = false;
    process.setEnvironment(env);
    process.setProcessChannelMode(QProcess::MergedChannels);
    process.start(path,args);
}