Example #1
0
void ListBoxControl::update (int pId)
{
  uicontrol::properties& up = properties<uicontrol> ();
  QListWidget* list = qWidget<QListWidget> ();

  switch (pId)
    {
    case uicontrol::properties::ID_STRING:
      m_blockCallback = true;
      list->clear ();
      list->addItems (Utils::fromStringVector (up.get_string_vector ()));
      updateSelection (list, up.get_value ().matrix_value ());
      m_blockCallback = false;
      break;
    case uicontrol::properties::ID_MIN:
    case uicontrol::properties::ID_MAX:
      if ((up.get_max () - up.get_min ()) > 1)
	list->setSelectionMode (QAbstractItemView::ExtendedSelection);
      else
	list->setSelectionMode (QAbstractItemView::SingleSelection);
      break;
    case uicontrol::properties::ID_VALUE:
      m_blockCallback = true;
      updateSelection (list, up.get_value ().matrix_value ());
      m_blockCallback = false;
      break;
    default:
      BaseControl::update (pId);
      break;
    }
}
Example #2
0
void MainWindow::fillLists(DisplayData *display)
{
    QListWidget* list;

    unsigned char rowsCount = display->getRowCount();
    if(font != nullptr)
    for(int i=1;i<=4;i++)
    {
        switch(i)
        {
            case 1:list = listOfRows1;break;
            case 2:list = listOfRows2;break;
            case 3:list = listOfRows3;break;
            case 4:list = listOfRows4;break;
        }
        if(rowsCount>=i)
        {
            list->clear();
            for(int j=0;j<display->getCountOfLinesInRow(i-1);j++)
            {
                QString text = QString::number(j) + ")" + display->getLine(i-1,j)->getAsString(font);
                list->addItem(text);
            }
        }
        quint16 num = lcd->getCurrentLineNumber(i-1);
        if(num<list->count()) list->setCurrentRow(num,QItemSelectionModel::SelectCurrent);
    }
}
Example #3
0
void AddPluginDialog::filter()
{
    QListWidget* pluginList = ui->pluginList;

    const int curr_item = 0 < pluginList->count() ? pluginList->currentRow() : 0;
    pluginList->clear();

    static QIcon fallIco = XdgIcon::fromTheme("preferences-plugin");

    int pluginCount = mPlugins.length();
    for (int i = 0; i < pluginCount; ++i)
    {
        const LxQt::PluginInfo &plugin = mPlugins.at(i);

        QString s = QString("%1 %2 %3 %4").arg(plugin.name(),
                                               plugin.comment(),
                                               plugin.value("Name").toString(),
                                               plugin.value("Comment").toString());
        if (!s.contains(ui->searchEdit->text(), Qt::CaseInsensitive))
            continue;

        QListWidgetItem* item = new QListWidgetItem(ui->pluginList);
        item->setText(QString("<b>%1</b><br>\n%2\n").arg(plugin.name(), plugin.comment()));
        item->setIcon(plugin.icon(fallIco));
        item->setData(INDEX_ROLE, i);
    }

    if (pluginCount > 0)
        ui->pluginList->setCurrentRow(curr_item < pluginCount ? curr_item : pluginCount - 1);
}
/** Loads the settings for this page */
void DirectoriesDialog::load()
{

	/* get the shared directories */
        rsiface->lockData(); /* Lock Interface */
	
	std::list<std::string>::const_iterator it;
	const std::list<std::string> &dirs = rsiface->getConfig().sharedDirList;
	
	/* get a link to the table */
	QListWidget *listWidget = ui.dirList;
	
	/* remove old items ??? */
	listWidget->clear();
	
	for(it = dirs.begin(); it != dirs.end(); it++)
	{
		/* (0) Dir Name */
		listWidget->addItem(QString::fromStdString(*it));
	}

	ui.incomingDir->setText(QString::fromStdString(rsiface->getConfig().incomingDir));
	
	rsiface->unlockData(); /* UnLock Interface */
	
	listWidget->update(); /* update display */


}
Example #5
0
void FireTrackWidgetPrivate::update_waveform_list()
{
	m_waveform_list->clear();
	int N=m_waveforms.N3();
	for (int i=0; i<N; i++) {
		QListWidgetItem *it=new QListWidgetItem();
		it->setText(QString("Neuron %1").arg(i+1));
		it->setData(Qt::UserRole,i);
		m_waveform_list->addItem(it);
	}
}
void Assessment::displayList(QWidget* wgtNav)
{
    stringstream outString;
    QListWidget* listWidget = wgtNav->findChild<QListWidget*>("lwgtAssess");
    QListWidget* listPercent = wgtNav->findChild<QListWidget*>("lwgtPercent");

    listWidget->clear();
    listPercent->clear();
    listWidget->addItem(QString::fromStdString(name));
    outString << fixed << setprecision(2) << getPercentage() << "%";
    listPercent->addItem(QString::fromStdString(outString.str()));
    listWidget->addItem("------------------------");
    listPercent->addItem("---");
    for (iter = opps.begin(); iter != opps.end(); iter++)
    {
        listWidget->addItem(QString::fromStdString((*iter)->getAssessName()));
        outString.str("");
        outString << fixed << setprecision(2) << (*iter)->getPercentage() << "%";
        listPercent->addItem(QString::fromStdString(outString.str()));
    }
}
void Assessment::listDetail(QWidget* wgtDetail)
{
    QListWidget* listTitles = wgtDetail->findChild<QListWidget*>("lwgtTitles");
    QListWidget* listValues = wgtDetail->findChild<QListWidget*>("lwgtValues");
    wgtDetail->findChild<QDoubleSpinBox*>("sedMark")->hide();
    wgtDetail->findChild<QLabel*>("lblName")->show();
    wgtDetail->findChild<QLabel*>("lblMark")->hide();
    wgtDetail->findChild<QLabel*>("lblTotal")->hide();
    wgtDetail->findChild<QLabel*>("lblName")->setText(QString::fromStdString(getAssessName()));
    stringstream outString;
    listTitles->clear();
    listValues->clear();

    listTitles->addItem(QString::fromStdString("Current Mark:"));
            outString << fixed << setprecision(2) << getPercentage() << "%";
    listValues->addItem(QString::fromStdString(outString.str()));

    listTitles->addItem(QString::fromStdString("Weighted:"));
            outString.str("");
            outString << fixed << setprecision(2) << getWeightedMark() << "/" << getWeight();
    listValues->addItem(QString::fromStdString(outString.str()));
}
Example #8
0
File: ACL.cpp Project: vmiklos/szar
void ACLController::buildList() {
	QListWidget *lw = m_ui->listWidget;
	lw->clear();
	m_hash.clear();
	VersionControl::UserAccessSeq *users = m_model->getUsers();
	for (unsigned int i = 0; i < users->length(); i++) {
		VersionControl::UserAccess user = (*users)[i];
		QString name = QString::fromUtf8(user.grantee->getName());
		QListWidgetItem *lwi = new QListWidgetItem(name);
		lwi->setCheckState(user.level == VersionControl::ReadWrite ? Qt::Checked : Qt::Unchecked);
		lw->addItem(lwi);
		m_hash[lwi] = user;
	}
}
Example #9
0
void LSQFitDialog::ListTarget()
{
    if (m_target)
    {
        Residue *res = m_target->residuesBegin();
        QListWidget *list = targetListWidget;
        list->clear();
        while (res != NULL)
        {
            list->addItem(resid(res).c_str());
            res = res->next();
        }
    }
}
void SceneDockWidget::rebuildMeshList()
{
    SceneData* data = controller->getSceneData();

    QListWidget* meshList = ui->listWidgetMeshes;
    meshList->clear();

    for(unsigned int i = 0; i < data->meshes.size(); ++i)
    {
        //Mesh* mesh = data->meshes.at(i).get();

        meshList->addItem(QString("Mesh%1").arg(i));
    }
}
void SceneDockWidget::rebuildMaterialList()
{
    SceneData* data = controller->getSceneData();

    QListWidget* materialList = ui->listWidgetMaterials;
    materialList->clear();

    for(unsigned int i = 0; i < data->materials.size(); ++i)
    {
        Material* mat = data->materials.at(i).get();

        materialList->addItem(QString::fromStdString(mat->name));
    }
}
void TabbedMainWindow::on_pushButtonFindUsers_clicked()
{
    for (int i = 0; i < clusterNamesF.count(); i++) {
        qDebug() << usernamePasswordsF[i];
    }
    int selectedType = ui->comboBoxQueryType->currentIndex();
    QString selectedParameter = ui->comboBoxQueryParameter->currentText();
    QString argumentData = ui->lineEditQueryData->text();
    for (int i = 0; i < myList.count(); i++) {
        // XXX: use this to update all lists, after getting their list data from getting the endusers
        QListWidget * list = myList[i];
        QListWidget * list2 = myList2[i];
        list->clear();
        list2->clear();
        findUsers(Variables::hostNamesF[i], Variables::usernamePasswordsF[i], selectedType, selectedParameter, argumentData, list, list2);
    }
}
Example #13
0
void GuiSpellchecker::updateSuggestions(docstring_list & words)
{
	QString const suggestion = toqstr(d->word_.word());
	d->ui.wordED->setText(suggestion);
	QListWidget * lw = d->ui.suggestionsLW;
	lw->clear();

	if (words.empty()) {
		on_suggestionsLW_itemClicked(new QListWidgetItem(suggestion));
		return;
	}
	for (size_t i = 0; i != words.size(); ++i)
		lw->addItem(toqstr(words[i]));

	on_suggestionsLW_itemClicked(lw->item(0));
	lw->setCurrentRow(0);
}
Example #14
0
void MainWindow::setSpellEffects(const Spell &spell)
{
    QListWidget *listArray[] = {
        ui->listEffect1,
        ui->listEffect2,
        ui->listEffect3
    };

    for (int i = 0 ; i < MAX_EFFECT_INDEX ; i++)
    {
        const SpellEffect &s        = spell.getSpellEffect(i);
        QListWidget *list         = listArray[i];

        list->clear();
        if (s.getEffect() == SPELL_EFFECT_NONE)
        {
            ui->tabWidgetEffects->setTabEnabled(i, false);
            ui->tabWidgetEffects->setTabText(i, "None");
        }
        else
        {
            ui->tabWidgetEffects->setTabEnabled(i, true);
            ui->tabWidgetEffects->setTabText(i, s.getName());
            list->addItem("Effect id: " + QString::number(s.getEffect()));
            list->addItem("Die sides: " + QString::number(s.getDieSides()));
            list->addItem("Base dice: " + QString::number(s.getBaseDice()));
            list->addItem("Dice per level: " + QString::number(s.getDicePerLevel()));
            list->addItem("Real points per level: " + QString::number(s.getRealPointsPerLevel()));
            list->addItem("Base point: " + QString::number(s.getBasePoint()));
            list->addItem("Mechanic: " + QString::number(s.getMechanic()));
            list->addItem("Implicit target A: " + QString::number(s.getImplicitTargetA()));
            list->addItem("Implicit target B: " + QString::number(s.getImplicitTargetB()));
            list->addItem("Radius index: " + QString::number(s.getRadius()));
            list->addItem("Apply aura name: " + s.getApplyAuraName());
            list->addItem("Amplitude: " + QString::number(s.getAmplitude()));
            list->addItem("Multiple value: " + QString::number(s.getMultipleValue()));
            list->addItem("Chain target: " + QString::number(s.getChainTarget()));
            list->addItem("Item type: " + QString::number(s.getItemType()));
            list->addItem("Misc value: " + QString::number(s.getMiscValueA()));
            list->addItem("Misc value B: " + QString::number(s.getMiscValueB()));
            list->addItem("Trigger spell: " + QString::number(s.getTriggerSpell()));
            list->addItem("Points per combo point: " + QString::number(s.getPointsPerComboPoint()));
            list->addItem("Damage multiplier: " + QString::number(s.getDmgMultiplier()));
        }
    }
}
void SceneDockWidget::rebuildTextureList()
{
    SceneData* data = controller->getSceneData();

    QListWidget* textureList = ui->listWidgetTextures;
    textureList->clear();

    for(unsigned int i = 0; i < data->materials.size(); ++i)
    {
        Material* mat = data->materials.at(i).get();

        for(unsigned int j = 0; j < mat->textures.size(); ++j)
        {
            textureList->addItem(QString::fromStdString(mat->textures.at(j)));
        }
    }
}
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_list_widget_clear (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QListWidget *lw = self->v8_to_qobject<QListWidget> (Args.This ());
      if (lw) {

         lw->clear ();
      }
   }

   return scope.Close (result);
}
Example #17
0
void AddPluginDialog::filter()
{
    QListWidget* pluginList = ui->pluginList;

    const int curr_item = 0 < pluginList->count() ? pluginList->currentRow() : 0;
    pluginList->clear();

    static QIcon fallIco = XdgIcon::fromTheme("preferences-plugin");

    int pluginCount = mPlugins.length();
    for (int i = 0; i < pluginCount; ++i)
    {
        const LXQt::PluginInfo &plugin = mPlugins.at(i);

        QString s = QStringLiteral("%1 %2 %3 %4").arg(plugin.name(),
                                               plugin.comment(),
                                               plugin.value("Name").toString(),
                                               plugin.value("Comment").toString());
        if (!s.contains(ui->searchEdit->text(), Qt::CaseInsensitive))
            continue;

        QListWidgetItem* item = new QListWidgetItem(ui->pluginList);
        // disable single-instances plugins already in use
        if (dynamic_cast<LXQtPanelApplication const *>(qApp)->isPluginSingletonAndRunnig(plugin.id()))
        {
            item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
            item->setBackground(palette().brush(QPalette::Disabled, QPalette::Text));
            item->setText(QStringLiteral("<b>%1</b><br>%2<br><small>%3</small>")
                    .arg(plugin.name(), plugin.comment(), tr("(only one instance can run at a time)")));
        } else
            item->setText(QStringLiteral("<b>%1</b><br>%2").arg(plugin.name(), plugin.comment()));
        item->setIcon(plugin.icon(fallIco));
        item->setData(INDEX_ROLE, i);
    }

    if (pluginCount > 0)
        ui->pluginList->setCurrentRow(curr_item < pluginCount ? curr_item : pluginCount - 1);
}
Example #18
0
void LSQFitDialog::ListSource()
{
    if (m_source)
    {
        Residue *res = m_source->residuesBegin();
        QListWidget *list = sourceListWidget;
        QComboBox *chains = chainsChoice;
        list->clear();
        chains->clear();
        int chainid = -9921;
        while (res != NULL)
        {
            if (res->chain_id() != chainid)
            {
                chainid = res->chain_id();
                char cid = (char) chainid;
                chains->addItem(QString(cid));
            }
            list->addItem(resid(res).c_str());
            res = res->next();
        }
    }
}
Example #19
0
/** Loads the settings for this page */
void ShareManager::load()
{
	std::list<std::string>::const_iterator it;
	std::list<std::string> dirs;
	rsFiles->getSharedDirectories(dirs);
	
	/* get a link to the table */
	QListWidget *listWidget = ui.shareddirList;
	
	/* remove old items ??? */
	listWidget->clear();
	
	for(it = dirs.begin(); it != dirs.end(); it++)
	{
		/* (0) Dir Name */
		listWidget->addItem(QString::fromStdString(*it));
	}

	//ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
	
	listWidget->update(); /* update display */


}
Example #20
0
void KFFOpt_scenery::reloadScenarii( bool showMessage )
{
	QListWidget* selected = ui_widget.selector_scenarii->selectedListWidget();
	QListWidget* available = ui_widget.selector_scenarii->availableListWidget();
	QStringList::Iterator ite;
	QIcon icon;
	QStringList list;
	int i = 0;
	bool found;

	selected->clear();
	available->clear();
	m_scenarii.clear();
	getScenarii();


	QMapIterator<QString, KFFScenarioData> it( m_scenarii );

	list = Settings::scenarii_selected();

	while ( it.hasNext() )
	{
		found = false;
		it.next();

		if ( it.value().type == "aircraft" || it.value().type == "tanker" ||
		        it.value().type == "wingman" || it.value().type == "ballistic" )
		{
			icon.addPixmap( m_aircraftIcon );
		}
		else if ( it.value().type == "thunderstorm" || it.value().type == "thermal" )
		{
			icon.addPixmap( m_weatherIcon );
		}
		else if ( it.value().type == "ship" || it.value().type == "carrier" )
		{
			icon.addPixmap( m_shipIcon );
		}
		else if (it.value().type == "groundvehicle" )
		{
			icon.addPixmap( m_trainIcon );
		}
		else
		{
			icon.addPixmap( m_unknowIcon );
		}

		QListWidgetItem* item = new QListWidgetItem( icon, it.key() );
		item->setToolTip(it.value().description);

		ite = list.begin();

		while ( !found && ite != list.end() )
		{
			if ( it.key() == *ite )
			{
				found = true;
			}

			ite++;
		}

		if ( found )
		{
			selected->insertItem( i++, item );
		}
		else
		{
			available->insertItem( i++, item );
		}

	}

	//loadSettings();
	if ( showMessage )
	{
		KMessageBox::information( this, i18n( "Reloaded" ) );
	}
}
Example #21
0
void Debugger::update()
{
	if (m_session.history.size())
	{
		WorldState const& nws = m_session.history[min((int)m_session.history.size() - 1, ui->debugTimeline->value())];
		WorldState const& ws = ui->callStack->currentRow() > 0 ? *nws.levels[nws.levels.size() - ui->callStack->currentRow()] : nws;

		if (ui->debugTimeline->value() >= m_session.history.size())
		{
			if (ws.gasCost > ws.gas)
				ui->debugMemory->setHtml("<h3>OUT-OF-GAS</h3>");
			else if (ws.inst == Instruction::RETURN && ws.stack.size() >= 2)
			{
				unsigned from = (unsigned)ws.stack.back();
				unsigned size = (unsigned)ws.stack[ws.stack.size() - 2];
				unsigned o = 0;
				bytes out(size, 0);
				for (; o < size && from + o < ws.memory.size(); ++o)
					out[o] = ws.memory[from + o];
				ui->debugMemory->setHtml("<h3>RETURN</h3>" + QString::fromStdString(dev::memDump(out, 16, true)));
			}
			else if (ws.inst == Instruction::STOP)
				ui->debugMemory->setHtml("<h3>STOP</h3>");
			else if (ws.inst == Instruction::SUICIDE && ws.stack.size() >= 1)
				ui->debugMemory->setHtml("<h3>SUICIDE</h3>0x" + QString::fromStdString(toString(right160(ws.stack.back()))));
			else
				ui->debugMemory->setHtml("<h3>EXCEPTION</h3>");

			ostringstream ss;
			ss << dec << "EXIT  |  GAS: " << dec << max<dev::bigint>(0, (dev::bigint)ws.gas - ws.gasCost);
			ui->debugStateInfo->setText(QString::fromStdString(ss.str()));
			ui->debugStorage->setHtml("");
			ui->debugCallData->setHtml("");
			m_session.currentData = h256();
			ui->callStack->clear();
			m_session.currentLevels.clear();
			ui->debugCode->clear();
			m_session.currentCode = h256();
			ui->debugStack->setHtml("");
		}
		else
		{
			if (m_session.currentLevels != nws.levels || !ui->callStack->count())
			{
				m_session.currentLevels = nws.levels;
				ui->callStack->clear();
				for (unsigned i = 0; i <= nws.levels.size(); ++i)
				{
					WorldState const& s = i ? *nws.levels[nws.levels.size() - i] : nws;
					ostringstream out;
					out << s.cur.abridged();
					if (i)
						out << " " << instructionInfo(s.inst).name << " @0x" << hex << s.curPC;
					ui->callStack->addItem(QString::fromStdString(out.str()));
				}
			}

			if (ws.code != m_session.currentCode)
			{
				m_session.currentCode = ws.code;
				bytes const& code = m_session.codes[ws.code];
				QListWidget* dc = ui->debugCode;
				dc->clear();
				m_session.pcWarp.clear();
				for (unsigned i = 0; i <= code.size(); ++i)
				{
					byte b = i < code.size() ? code[i] : 0;
					try
					{
						QString s = QString::fromStdString(instructionInfo((Instruction)b).name);
						ostringstream out;
						out << hex << setw(4) << setfill('0') << i;
						m_session.pcWarp[i] = dc->count();
						if (b >= (byte)Instruction::PUSH1 && b <= (byte)Instruction::PUSH32)
						{
							unsigned bc = b - (byte)Instruction::PUSH1 + 1;
							s = "PUSH 0x" + QString::fromStdString(toHex(bytesConstRef(&code[i + 1], bc)));
							i += bc;
						}
						dc->addItem(QString::fromStdString(out.str()) + "  "  + s);
					}
					catch (...)
					{
						cerr << "Unhandled exception!" << endl << boost::current_exception_diagnostic_information();
						break;	// probably hit data segment
					}
				}
			}

			if (ws.callData != m_session.currentData)
			{
				m_session.currentData = ws.callData;
				if (ws.callData)
				{
					assert(m_session.codes.count(ws.callData));
					ui->debugCallData->setHtml(QString::fromStdString(dev::memDump(m_session.codes[ws.callData], 16, true)));
				}
				else
					ui->debugCallData->setHtml("");
			}

			QString stack;
			for (auto i: ws.stack)
				stack.prepend("<div>" + m_context->prettyU256(i) + "</div>");
			ui->debugStack->setHtml(stack);
			ui->debugMemory->setHtml(QString::fromStdString(dev::memDump(ws.memory, 16, true)));
			assert(m_session.codes.count(ws.code));

			if (m_session.codes[ws.code].size() >= (unsigned)ws.curPC)
			{
				int l = m_session.pcWarp[(unsigned)ws.curPC];
				ui->debugCode->setCurrentRow(max(0, l - 5));
				ui->debugCode->setCurrentRow(min(ui->debugCode->count() - 1, l + 5));
				ui->debugCode->setCurrentRow(l);
			}
			else
				cwarn << "PC (" << (unsigned)ws.curPC << ") is after code range (" << m_session.codes[ws.code].size() << ")";

			ostringstream ss;
			ss << dec << "STEP: " << ws.steps << "  |  PC: 0x" << hex << ws.curPC << "  :  " << instructionInfo(ws.inst).name << "  |  ADDMEM: " << dec << ws.newMemSize << " words  |  COST: " << dec << ws.gasCost <<  "  |  GAS: " << dec << ws.gas;
			ui->debugStateInfo->setText(QString::fromStdString(ss.str()));
			stringstream s;
			for (auto const& i: ws.storage)
				s << "@" << m_context->prettyU256(i.first).toStdString() << "&nbsp;&nbsp;&nbsp;&nbsp;" << m_context->prettyU256(i.second).toStdString() << "<br/>";
			ui->debugStorage->setHtml(QString::fromStdString(s.str()));
		}
	}
}
Example #22
0
void BackupsWidget::emptyListWidget(QListWidget &list)
{
    list.clear();
}