Esempio n. 1
0
SpiceDialog::SpiceDialog(SpiceFile *c, Schematic *d)
			: QDialog(d, 0, TRUE, Qt::WDestructiveClose)
{
  resize(400, 250);
  setCaption(tr("Edit SPICE Component Properties"));
  Comp = c;
  Doc  = d;

  all = new Q3VBoxLayout(this); // to provide neccessary size
  QWidget *myParent = this;

  Expr.setPattern("[^\"=]+");  // valid expression for property 'edit' etc
  Validator = new QRegExpValidator(Expr, this);
  Expr.setPattern("[\\w_]+");  // valid expression for property 'NameEdit' etc
  ValRestrict = new QRegExpValidator(Expr, this);


  // ...........................................................
  Q3GridLayout *topGrid = new Q3GridLayout(0, 4,3,3,3);
  all->addLayout(topGrid);

  topGrid->addWidget(new QLabel(tr("Name:"), myParent), 0,0);
  CompNameEdit = new QLineEdit(myParent);
  CompNameEdit->setValidator(ValRestrict);
  topGrid->addWidget(CompNameEdit, 0,1);
  connect(CompNameEdit, SIGNAL(returnPressed()), SLOT(slotButtOK()));

  topGrid->addWidget(new QLabel(tr("File:"), myParent), 1,0);
  FileEdit = new QLineEdit(myParent);
  FileEdit->setValidator(ValRestrict);
  topGrid->addWidget(FileEdit, 1,1);
  connect(FileEdit, SIGNAL(returnPressed()), SLOT(slotButtOK()));

  ButtBrowse = new QPushButton(tr("Browse"), myParent);
  topGrid->addWidget(ButtBrowse, 1,2);
  connect(ButtBrowse, SIGNAL(clicked()), SLOT(slotButtBrowse()));

  ButtEdit = new QPushButton(tr("Edit"), myParent);
  topGrid->addWidget(ButtEdit, 2,2);
  connect(ButtEdit, SIGNAL(clicked()), SLOT(slotButtEdit()));

  FileCheck = new QCheckBox(tr("show file name in schematic"), myParent);
  topGrid->addWidget(FileCheck, 2,1);

  SimCheck = new QCheckBox(tr("include SPICE simulations"), myParent);
  topGrid->addWidget(SimCheck, 3,1);

  Q3HBox *h1 = new Q3HBox(myParent);
  h1->setSpacing(5);
  PrepCombo = new QComboBox(h1);
  PrepCombo->insertItem("none");
  PrepCombo->insertItem("ps2sp");
  PrepCombo->insertItem("spicepp");
  PrepCombo->insertItem("spiceprm");
  QLabel * PrepLabel = new QLabel(tr("preprocessor"), h1);
  PrepLabel->setMargin(5);
  topGrid->addWidget(h1, 4,1);
  connect(PrepCombo, SIGNAL(activated(int)), SLOT(slotPrepChanged(int)));

  // ...........................................................
  Q3GridLayout *midGrid = new Q3GridLayout(0, 2,3,5,5);
  all->addLayout(midGrid);

  midGrid->addWidget(new QLabel(tr("SPICE net nodes:"), myParent), 0,0);
  NodesList = new Q3ListBox(myParent);
  midGrid->addWidget(NodesList, 1,0);
  connect(NodesList, SIGNAL(doubleClicked(Q3ListBoxItem*)),
	SLOT(slotAddPort(Q3ListBoxItem*)));
  
  Q3VBox *v0 = new Q3VBox(myParent);
  v0->setSpacing(5);
  midGrid->addWidget(v0, 1,1);
  ButtAdd = new QPushButton(tr("Add >>"), v0);
  connect(ButtAdd, SIGNAL(clicked()), SLOT(slotButtAdd()));
  ButtRemove = new QPushButton(tr("<< Remove"), v0);
  connect(ButtRemove, SIGNAL(clicked()), SLOT(slotButtRemove()));
  v0->setStretchFactor(new QWidget(v0), 5); // stretchable placeholder

  midGrid->addWidget(new QLabel(tr("Component ports:"), myParent), 0,2);
  PortsList = new Q3ListBox(myParent);
  midGrid->addWidget(PortsList, 1,2);
  connect(PortsList, SIGNAL(doubleClicked(Q3ListBoxItem*)),
	SLOT(slotRemovePort(Q3ListBoxItem*)));
  

  // ...........................................................
  Q3HBox *h0 = new Q3HBox(this);
  h0->setSpacing(5);
  all->addWidget(h0);
  connect(new QPushButton(tr("OK"),h0), SIGNAL(clicked()),
	  SLOT(slotButtOK()));
  connect(new QPushButton(tr("Apply"),h0), SIGNAL(clicked()),
	  SLOT(slotButtApply()));
  connect(new QPushButton(tr("Cancel"),h0), SIGNAL(clicked()),
	  SLOT(slotButtCancel()));

  // ------------------------------------------------------------
  CompNameEdit->setText(Comp->Name);
  changed = false;

  // insert all properties into the ListBox
  Property *pp = Comp->Props.first();
  FileEdit->setText(pp->Value);
  FileCheck->setChecked(pp->display);
  SimCheck->setChecked(Comp->Props.at(2)->Value == "yes");
  for(int i=0; i<PrepCombo->count(); i++) {
    if(PrepCombo->text(i) == Comp->Props.at(3)->Value) {
      PrepCombo->setCurrentItem(i);
      currentPrep = i;
      break;
    }
  }

  loadSpiceNetList(pp->Value);  // load netlist nodes
}
Esempio n. 2
0
void StatsView::on_statsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
	if (current == 0)
		return;
	std::string data = "";
	if (current->childCount() == 0) {
		DataContainerTreeItem *treeData = (DataContainerTreeItem *)current;
		data = treeData->getData();
	}
	QTreeWidget *statsTree = this->findChild<QTreeWidget *>("statsTree");
	QLabel *modName = this->findChild<QLabel *>("modName");
	QTableWidget *modTable = this->findChild<QTableWidget *>("modTable");
	modTable->blockSignals(true);
	StatsContainer *itemStats = GenStatsReader::getContainer(allItemStats, data.c_str());
	if (itemStats != 0) {
		modName->setText(itemStats->getArg(0).c_str());
		std::map<std::string, std::string> baseData = itemStats->getBaseDataMap();
		if (itemStats->getUsing() != 0) {
			std::map<std::string, std::string> parentData = itemStats->getUsing()->getBaseDataMap();
			for (std::map<std::string, std::string>::iterator it = parentData.begin(); it != parentData.end(); ++it) {
				if (baseData.find(it->first) == baseData.end()) {
					baseData[it->first] = it->second;
				}
			}
		}
		for (int i=0; i<modTable->rowCount(); ++i) {
			for (int j=0; j<modTable->columnCount(); ++j) {
				delete modTable->item(i, j);
			}
		}
		modTable->setRowCount(0);
		int row = 0;
		if (itemStats->getContainerType() == "deltamod") {
			StatsContainer *boost = GenStatsReader::getContainer(allItemStats, itemStats->getBoostName());
			if (boost != 0) {
				std::map<std::string, std::string> boostMap = boost->getBaseDataMap();
				for (std::map<std::string, std::string>::iterator it = boostMap.begin(); it != boostMap.end(); ++it) {
					if (baseData.find(it->first) == baseData.end()) {
						baseData[it->first] = it->second;
					}
				}
			}
			for (int i=0; i<itemStats->getPrefixList().size(); ++i) {
				QTableWidgetItem *nameItem = new QTableWidgetItem();
				nameItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable);
				nameItem->setText("Prefix");
				QTableWidgetItem *valueItem = new QTableWidgetItem();
				valueItem->setFlags(valueItem->flags() & ~Qt::ItemIsEditable);
				valueItem->setText(itemStats->getPrefixList()[i].c_str());
				modTable->insertRow(row);
				modTable->setItem(row, 0, nameItem);
				modTable->setItem(row, 1, valueItem);
				++row;
			}
			for (int i=0; i<itemStats->getSuffixList().size(); ++i) {
				QTableWidgetItem *nameItem = new QTableWidgetItem();
				nameItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable);
				nameItem->setText("Suffix");
				QTableWidgetItem *valueItem = new QTableWidgetItem();
				valueItem->setFlags(valueItem->flags() & ~Qt::ItemIsEditable);
				valueItem->setText(itemStats->getSuffixList()[i].c_str());
				modTable->insertRow(row);
				modTable->setItem(row, 0, nameItem);
				modTable->setItem(row, 1, valueItem);
				++row;
			}
		}
		for (std::map<std::string, std::string>::iterator it = baseData.begin(); it != baseData.end(); ++it) {
			QTableWidgetItem *nameItem = new QTableWidgetItem();
			nameItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable);
			nameItem->setText(it->first.c_str());
			QTableWidgetItem *valueItem = new QTableWidgetItem();
			valueItem->setFlags(valueItem->flags() & ~Qt::ItemIsEditable);
			valueItem->setText(it->second.c_str());
			modTable->insertRow(row);
			modTable->setItem(row, 0, nameItem);
			modTable->setItem(row, 1, valueItem);
			++row;
		}
		
		modTable->resizeRowsToContents();
		modTable->resizeColumnsToContents();
	} else if (current->childCount() == 0) {
		bool canEdit = true;
		if (current->text(0) == "Abilities") {
			canEdit = false;
		}
		QStringList headerList;
		headerList.push_back("Name");
		if (canEdit) {
			headerList.push_back("Editable Value");
		} else {
			headerList.push_back("Value");
		}
		modTable->setHorizontalHeaderLabels(headerList);
		for (int i=0; i<modTable->rowCount(); ++i) {
			for (int j=0; j<modTable->columnCount(); ++j) {
				delete modTable->item(i, j);
			}
		}
		modTable->setRowCount(0);
		int row = 0;
		modTable->insertRow(row);
		QTableWidgetItem *nameItem = new QTableWidgetItem();
		nameItem->setText(current->text(0));
		nameItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable);
		modTable->setItem(row, 0, nameItem);
		QTableWidgetItem *valueItem = new QTableWidgetItem();
		if (!canEdit) {
			valueItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable);
		}
		valueItem->setText(data.c_str());
		modTable->setItem(row, 1, valueItem);
		
		modTable->resizeRowsToContents();
		modTable->resizeColumnsToContents();
	}
	modTable->blockSignals(false);
}
void WindowMaterialShadeInspectorView::createLayout()
{
  auto hiddenWidget = new QWidget();
  this->stackedWidget()->addWidget(hiddenWidget);

  auto visibleWidget = new QWidget();
  this->stackedWidget()->addWidget(visibleWidget);

  auto mainGridLayout = new QGridLayout();
  mainGridLayout->setContentsMargins(7, 7, 7, 7);
  mainGridLayout->setSpacing(14);
  visibleWidget->setLayout(mainGridLayout);

  int row = mainGridLayout->rowCount();

  QLabel * label = nullptr;

  // Name

  label = new QLabel("Name: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label, row, 0);

  ++row;

  m_nameEdit = new OSLineEdit();
  mainGridLayout->addWidget(m_nameEdit, row, 0, 1, 3);

  ++row;

  // Standards Information

  m_standardsInformationWidget = new StandardsInformationMaterialWidget(m_isIP, mainGridLayout, row);

  ++row;

  // Solar Transmittance

  label = new QLabel("Solar Transmittance: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_solarTransmittance = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_solarTransmittance, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_solarTransmittance,row++,0,1,3);

  // Solar Reflectance

  label = new QLabel("Solar Reflectance: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_solarReflectance = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_solarReflectance, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_solarReflectance,row++,0,1,3);

  // Visible Transmittance

  label = new QLabel("Visible Transmittance: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_visibleTransmittance = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_visibleTransmittance, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_visibleTransmittance,row++,0,1,3);

  // Visible Reflectance

  label = new QLabel("Visible Reflectance: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_visibleReflectance = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_visibleReflectance, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_visibleReflectance,row++,0,1,3);

  // Thermal Hemispherical Emissivity

  label = new QLabel("Thermal Hemispherical Emissivity: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_thermalHemisphericalEmissivity = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_thermalHemisphericalEmissivity, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_thermalHemisphericalEmissivity,row++,0,1,3);

  // Thermal Transmittance

  label = new QLabel("Thermal Transmittance: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_thermalTransmittance = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_thermalTransmittance, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_thermalTransmittance,row++,0,1,3);

  // Thickness

  label = new QLabel("Thickness: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_thickness = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_thickness, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_thickness,row++,0,1,3);

  // Conductivity

  label = new QLabel("Conductivity: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_conductivity = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_conductivity, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_conductivity,row++,0,1,3);

  // Shade To Glass Distance

  label = new QLabel("Shade To Glass Distance: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_shadeToGlassDistance = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_shadeToGlassDistance, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_shadeToGlassDistance,row++,0,1,3);

  // Top Opening Multiplier

  label = new QLabel("Top Opening Multiplier: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_topOpeningMultiplier = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_topOpeningMultiplier, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_topOpeningMultiplier,row++,0,1,3);

  // Bottom Opening Multiplier

  label = new QLabel("Bottom Opening Multiplier: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_bottomOpeningMultiplier = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_bottomOpeningMultiplier, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_bottomOpeningMultiplier,row++,0,1,3);

  // Left-Side Opening Multiplier

  label = new QLabel("Left-Side Opening Multiplier: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_leftSideOpeningMultiplier = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_leftSideOpeningMultiplier, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_leftSideOpeningMultiplier,row++,0,1,3);

  // Right-Side Opening Multiplier

  label = new QLabel("Right-Side Opening Multiplier: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_rightSideOpeningMultiplier = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_rightSideOpeningMultiplier, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_rightSideOpeningMultiplier,row++,0,1,3);

  // Airflow Permeability

  label = new QLabel("Airflow Permeability: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_airflowPermeability = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialShadeInspectorView::toggleUnitsClicked, m_airflowPermeability, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_airflowPermeability,row++,0,1,3);

  // Stretch

  mainGridLayout->setRowStretch(100,100);

  mainGridLayout->setColumnStretch(100,100);
}
Esempio n. 4
0
void FenPrincipale::calcul_manches() {
	for (int j = 0;  j < this->nbManches; ++j) {
			// on initialise la table html pour l'export
		QString html = "<table>\n\t<thead>\n\t\t<tr>\n\t\t\t";
		html += "<td>"+tr("Place")+"</td>";
		html += "<td>"+tr("Équipage")+"</td>";
		html += "<td>"+tr("Points")+"</td>";
		if (this->typeClmt == CLMT_TEMPS) {
			html += "<td>"+tr("Temps réel")+"</td><td>"+tr("Temps compensé")+"</td>";
		}
		html += "\n\t\t</tr>\n\t</thead>\n\t<tboby>";
			// on affiche la table qui va contenir les résultats de la manche
		QTableWidget *table = new QTableWidget();
		table->verticalHeader()->hide();
		table->setSelectionMode(QAbstractItemView::NoSelection);
		table->setProperty("table", "manches");
		QList<QString> labels;
		labels << tr("Place") << tr("Équipage") << tr("Points");
		if (this->typeClmt == CLMT_TEMPS) {
			table->setColumnCount(5);
			labels << tr("Temps réel") << tr("Temps compensé");
			table->setMaximumWidth(560 + 20);
			table->setMinimumWidth(560 + 20);
			table->setColumnWidth(3, 120);
			table->setColumnWidth(4, 120);
		}
		else {
			table->setColumnCount(3);
			table->setMaximumWidth(320 + 20);
			table->setMinimumWidth(320 + 20);
		}
		table->setColumnWidth(0, 60);
		table->setColumnWidth(1, 200);
		table->setColumnWidth(2, 60);
		table->setHorizontalHeaderLabels(labels);
		table->setRowCount(this->nbEquipages);
		ui->choisirResultat->insertItem(j+1,
			tr("Résultats de la manche %1").arg(QString::number(j+1)));
		int nbAffiches = 0; // pour savoir à quelle ligne on en est
			// on traite et affiche les équipages
		// on traite chaque manche pour attribuer les points aux équipages
		for (int i = 0; i < this->nbEquipages; ++i) {
			// on recherche tous les équipages non encore traités pour cette
			// manches qui ont un tpsCompense minimal
			int min = 0;
			QList<int> ids;
			for (int k = 0; k < this->nbEquipages; ++k) {
				Manche m = this->equipages[k].manches[j];
				if (m.tpsCompense < 0 || m.points > 0 ) {
					// cet équipage a déjà été traité ou n'a pas de place/temps
					// (DNF, DNS, OCS, ...)
					continue;
				}
				if (m.tpsCompense < min || min == 0) {
					min = m.tpsCompense;
					ids.clear();
					ids.append(k);
				}
				else if (m.tpsCompense == min) {
					ids.append(k);
				}
			}
			if (min == 0) {
				// on n'a pas trouvé d'équipage à traiter (se produit s'il y a
				// des équipages DNS, DNF, OCS, ...)
				break;
			}
			for (int l = 0; l < ids.size(); ++l) {
				double points = (ids.size()-1.0)/2.0+i+1.0;
				this->equipages[ids.at(l)].points += points;
				this->equipages[ids.at(l)].pointsOrdonnes.prepend(points);
				this->equipages[ids.at(l)].pointsTries.append(points);
				this->equipages[ids.at(l)].manches[j].points = points;
				// on affiche ces équipages
				Equipage e = this->equipages[ids.at(l)];
				Manche m = e.manches[j];
				QLabel *place = new QLabel(QString::number(i+1));
				table->setCellWidget(i+l, 0, place);
				QWidget *nomWidget = new QWidget();
				QVBoxLayout *nomLayout = new QVBoxLayout();
				QLabel *nom = new QLabel(e.nom);
				nom->setProperty("label", "nom");
				nomLayout->addWidget(nom);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *bateau = new QLabel();
					bateau->setText(this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")");
					bateau->setProperty("label", "bateau");
					nomLayout->addWidget(bateau);
					table->setRowHeight(i+l, 45);
				}
				nomLayout->setContentsMargins(0, 0, 0, 0);
				nomLayout->setSpacing(0);
				nomWidget->setLayout(nomLayout);
				table->setCellWidget(i+l, 1, nomWidget);
				QLabel *pointsi = new QLabel(QString::number(m.points));
				table->setCellWidget(i+l, 2, pointsi);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *tpsReel = new QLabel(this->formate_tps(m.tpsReel));
					table->setCellWidget(i+l, 3, tpsReel);
					QLabel *tpsCompense = new QLabel(this->formate_tps(qRound(m.tpsCompense)));
					table->setCellWidget(i+l, 4, tpsCompense);
				}
				// on ajoute l'équipage à la table html
				QString nomString = "<span class=\"equipage\">"+e.nom+"</span>";
				if (this->typeClmt == CLMT_TEMPS) {
					nomString += "<span class=\"bateau\">"
						+this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")</span>";
				}
				html += "\n\t\t<tr>\n\t\t\t<td>"+QString::number(i+1)+"</td>"
					+"<td>"+nomString+"</td>"
					+"<td>"+QString::number(m.points)+"</td>";
				if (this->typeClmt == CLMT_TEMPS) {
					html += "<td>"+this->formate_tps(m.tpsReel)+"</td>"
						+"<td>"+this->formate_tps(qRound(m.tpsCompense))+"</td>";
				}
				html += "\n\t\t</tr>";
				++nbAffiches;
			}
			i = i+ids.size()-1;
		}
		// on traite les équipages qui n'ont pas de place/temps
		for (int i = 0; i < this->nbEquipages; ++i) {
			if (this->equipages[i].manches[j].tpsCompense < 0) {
				double points = this->nbEquipages+1.0;
				this->equipages[i].points += points;
				this->equipages[i].pointsOrdonnes.prepend(points);
				this->equipages[i].pointsTries.append(points);
				this->equipages[i].manches[j].points = points;
				// on affiche ces équipages
				Equipage e = this->equipages[i];
				Manche m = e.manches[j];
				QString abr = this->get_abr(m.abr);
				QLabel *place = new QLabel(abr);
				table->setCellWidget(nbAffiches, 0, place);
				QWidget *nomWidget = new QWidget();
				QVBoxLayout *nomLayout = new QVBoxLayout();
				QLabel *nom = new QLabel(e.nom);
				nom->setProperty("label", "nom");
				nomLayout->addWidget(nom);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *bateau = new QLabel();
					bateau->setText(this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")");
					bateau->setProperty("label", "bateau");
					nomLayout->addWidget(bateau);
					table->setRowHeight(nbAffiches, 45);
				}
				nomLayout->setContentsMargins(0, 0, 0, 0);
				nomLayout->setSpacing(0);
				nomWidget->setLayout(nomLayout);
				table->setCellWidget(nbAffiches, 1, nomWidget);
				QLabel *pointsi = new QLabel(QString::number(m.points));
				table->setCellWidget(nbAffiches, 2, pointsi);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *tpsReel = new QLabel(abr);
					table->setCellWidget(nbAffiches, 3, tpsReel);
					QLabel *tpsCompense = new QLabel(abr);
					table->setCellWidget(nbAffiches, 4, tpsCompense);
				}
				// on ajoute l'équipage à la table html
				QString nomString = "<span class=\"equipage\">"+e.nom+"</span>";
				if (this->typeClmt == CLMT_TEMPS) {
					nomString += "<span class=\"bateau\">"
						+this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")</span>";
				}
				html += "\n\t\t<tr>\n\t\t\t<td>"+abr+"</td><td>"+nomString+"</td>"
					+"<td>"+QString::number(m.points)+"</td>";
				if (this->typeClmt == CLMT_TEMPS) {
					html += "<td>"+abr+"</td><td>"+abr+"</td>";
				}
				html += "\n\t\t</tr>";
				++nbAffiches;
			}
		}
		ui->resultatsLayout->addWidget(table);
		table->hide();
		html += "\n\t</tbody>\n</table>";
		this->htmls.append(html);
		this->progression(5+j*75/this->nbManches);
	}
	// on trie les liste pointsTries
	for (int i = 0; i < this->nbEquipages; ++i) {
		qSort(this->equipages[i].pointsTries);
	}
}
Esempio n. 5
0
PropertiesDialog::PropertiesDialog(QWidget *parent, Okular::Document *doc)
    : KPageDialog( parent ), m_document( doc ), m_fontPage( 0 ),
      m_fontModel( 0 ), m_fontInfo( 0 ), m_fontProgressBar( 0 ),
      m_fontScanStarted( false )
{
    setFaceType( Tabbed );
    setCaption( i18n( "Unknown File" ) );
    setButtons( Ok );

    // PROPERTIES
    QFrame *page = new QFrame();
    KPageWidgetItem *item = addPage( page, i18n( "&Properties" ) );
    item->setIcon( KIcon( "document-properties" ) );

    // get document info
    const Okular::DocumentInfo info = doc->documentInfo();
    QFormLayout *layout = new QFormLayout( page );

    // mime name based on mimetype id
    QString mimeName = info.get( Okular::DocumentInfo::MimeType ).section( '/', -1 ).toUpper();
    setCaption( i18n( "%1 Properties", mimeName ) );

    int valMaxWidth = 100;

    /* obtains the properties list, conveniently ordered */
    QStringList orderedProperties;
    orderedProperties << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::FilePath )
                      << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::PagesSize )
                      << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::DocumentSize );
    for (Okular::DocumentInfo::Key ks = Okular::DocumentInfo::Title;
                                   ks <= Okular::DocumentInfo::Keywords;
                                   ks = Okular::DocumentInfo::Key( ks+1 ) )
    {
        orderedProperties << Okular::DocumentInfo::getKeyString( ks );
    }
    foreach( const QString &ks, info.keys()) {
        if ( !orderedProperties.contains( ks ) ) {
            orderedProperties << ks;
        }
    }

    for ( QStringList::Iterator it = orderedProperties.begin();
                                it != orderedProperties.end();
                                ++it )
    {
        const QString key = *it;
        const QString titleString = info.getKeyTitle( key );
        const QString valueString = info.get( key );
        if ( titleString.isNull() || valueString.isNull() )
            continue;

        // create labels and layout them
        QWidget *value = NULL;
        if ( key == Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::MimeType ) ) {
            /// for mime type fields, show icon as well
            value = new QWidget( page );
            /// place icon left of mime type's name
            QHBoxLayout *hboxLayout = new QHBoxLayout( value );
            hboxLayout->setMargin( 0 );
            /// retrieve icon and place it in a QLabel
            KMimeType::Ptr mimeType = KMimeType::mimeType( valueString );
            KSqueezedTextLabel *squeezed;
            if (!mimeType.isNull()) {
                /// retrieve icon and place it in a QLabel
                QLabel *pixmapLabel = new QLabel( value );
                hboxLayout->addWidget( pixmapLabel, 0 );
                pixmapLabel->setPixmap( KIconLoader::global()->loadMimeTypeIcon( mimeType->iconName(), KIconLoader::Small ) );
                /// mime type's name and label
                squeezed = new KSqueezedTextLabel( i18nc( "mimetype information, example: \"PDF Document (application/pdf)\"", "%1 (%2)", mimeType->comment(), valueString ), value );
            } else {
                /// only mime type name
                squeezed = new KSqueezedTextLabel( valueString, value );
            }
            squeezed->setTextInteractionFlags( Qt::TextSelectableByMouse );
            hboxLayout->addWidget( squeezed, 1 );
        } else {
            /// default for any other document information
            KSqueezedTextLabel *label = new KSqueezedTextLabel( valueString, page );
            label->setTextInteractionFlags( Qt::TextSelectableByMouse );
            value = label;
        }
        layout->addRow( new QLabel( i18n( "%1:", titleString ) ), value);

        // refine maximum width of 'value' labels
        valMaxWidth = qMax( valMaxWidth, fontMetrics().width( valueString ) );
    }

    // FONTS
    QVBoxLayout *page2Layout = 0;
    if ( doc->canProvideFontInformation() ) {
        // create fonts tab and layout it
        QFrame *page2 = new QFrame();
        m_fontPage = addPage(page2, i18n("&Fonts"));
        m_fontPage->setIcon( KIcon( "preferences-desktop-font" ) );
        page2Layout = new QVBoxLayout(page2);
        page2Layout->setMargin(marginHint());
        page2Layout->setSpacing(spacingHint());
        // add a tree view
        QTreeView *view = new QTreeView(page2);
        view->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showFontsMenu(QPoint)));
        page2Layout->addWidget(view);
        view->setRootIsDecorated(false);
        view->setAlternatingRowColors(true);
        view->setSortingEnabled( true );
        // creating a proxy model so we can sort the data
        QSortFilterProxyModel *proxymodel = new QSortFilterProxyModel(view);
        proxymodel->setDynamicSortFilter( true );
        proxymodel->setSortCaseSensitivity( Qt::CaseInsensitive );
        m_fontModel = new FontsListModel(view);
        proxymodel->setSourceModel(m_fontModel);
        view->setModel(proxymodel);
        view->sortByColumn( 0, Qt::AscendingOrder );
        m_fontInfo = new QLabel( this );
        page2Layout->addWidget( m_fontInfo );
        m_fontInfo->setText( i18n( "Reading font information..." ) );
        m_fontInfo->hide();
        m_fontProgressBar = new QProgressBar( this );
        page2Layout->addWidget( m_fontProgressBar );
        m_fontProgressBar->setRange( 0, 100 );
        m_fontProgressBar->setValue( 0 );
        m_fontProgressBar->hide();
    }

    // current width: left columnt + right column + dialog borders
    int width = layout->minimumSize().width() + valMaxWidth + 2 * marginHint() + spacingHint() + 30;
    if ( page2Layout )
        width = qMax( width, page2Layout->sizeHint().width() + marginHint() + spacingHint() + 31 );
    // stay inside the 2/3 of the screen width
    QRect screenContainer = KGlobalSettings::desktopGeometry( this );
    width = qMin( width, 2*screenContainer.width()/3 );
    resize(width, 1);

    connect( pageWidget(), SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
             this, SLOT(pageChanged(KPageWidgetItem*,KPageWidgetItem*)) );
}
Esempio n. 6
0
void DhtWindow::updateNetStatus()
{

		QString status;
	QString oldstatus;

#if 0
		status = QString::fromStdString(mPeerNet->getPeerStatusString());
	oldstatus = ui.peerLine->text();
	if (oldstatus != status)
	{
		ui.peerLine->setText(status);
	}
#endif

		status = QString::fromStdString(rsDht->getUdpAddressString());
	oldstatus = ui.peerAddressLabel->text();
	if (oldstatus != status)
	{
		ui.peerAddressLabel->setText(status);
	}

	uint32_t netMode = rsConfig->getNetworkMode();

	QLabel *label = ui.networkLabel;
	switch(netMode)
	{
		case RSNET_NETWORK_UNKNOWN:
			label->setText(tr("Unknown NetState"));
			break;
		case RSNET_NETWORK_OFFLINE:
			label->setText(tr("Offline"));
			break;
		case RSNET_NETWORK_LOCALNET:
			label->setText(tr("Local Net"));
			break;
		case RSNET_NETWORK_BEHINDNAT:
			label->setText(tr("Behind NAT"));
			break;
		case RSNET_NETWORK_EXTERNALIP:
			label->setText(tr("External IP"));
			break;
	}

	label = ui.natTypeLabel;

	uint32_t natType = rsConfig->getNatTypeMode();
	switch(natType)
	{
		case RSNET_NATTYPE_UNKNOWN:
			label->setText(tr("UNKNOWN NAT STATE"));
			break;
		case RSNET_NATTYPE_SYMMETRIC:
			label->setText(tr("SYMMETRIC NAT"));
			break;
		case RSNET_NATTYPE_DETERM_SYM:
			label->setText(tr("DETERMINISTIC SYM NAT"));
			break;
		case RSNET_NATTYPE_RESTRICTED_CONE:
			label->setText(tr("RESTRICTED CONE NAT"));
			break;
		case RSNET_NATTYPE_FULL_CONE:
			label->setText(tr("FULL CONE NAT"));
			break;
		case RSNET_NATTYPE_OTHER:
			label->setText(tr("OTHER NAT"));
			break;
		case RSNET_NATTYPE_NONE:
			label->setText(tr("NO NAT"));
			break;
	}



	label = ui.natHoleLabel;
	uint32_t natHole = rsConfig->getNatHoleMode();

	switch(natHole)
	{
		case RSNET_NATHOLE_UNKNOWN:
			label->setText(tr("UNKNOWN NAT HOLE STATUS"));
			break;
		case RSNET_NATHOLE_NONE:
			label->setText(tr("NO NAT HOLE"));
			break;
		case RSNET_NATHOLE_UPNP:
			label->setText(tr("UPNP FORWARD"));
			break;
		case RSNET_NATHOLE_NATPMP:
			label->setText(tr("NATPMP FORWARD"));
			break;
		case RSNET_NATHOLE_FORWARDED:
			label->setText(tr("MANUAL FORWARD"));
			break;
	}

	uint32_t connect = rsConfig->getConnectModes();

	label = ui.connectLabel;
	QString connOut;
	if (connect & RSNET_CONNECT_OUTGOING_TCP)
	{
		connOut += "TCP_OUT ";
	}
	if (connect & RSNET_CONNECT_ACCEPT_TCP)
	{
		connOut += "TCP_IN ";
	}
	if (connect & RSNET_CONNECT_DIRECT_UDP)
	{
		connOut += "DIRECT_UDP ";
	}
	if (connect & RSNET_CONNECT_PROXY_UDP)
	{
		connOut += "PROXY_UDP ";
	}
	if (connect & RSNET_CONNECT_RELAY_UDP)
	{
		connOut += "RELAY_UDP ";
	}

	label->setText(connOut);

	uint32_t netState = rsConfig->getNetState();

	label = ui.netStatusLabel;
	switch(netState)
	{
		case RSNET_NETSTATE_BAD_UNKNOWN:
			label->setText(tr("NET BAD: Unknown State"));
			break;
		case RSNET_NETSTATE_BAD_OFFLINE:
			label->setText(tr("NET BAD: Offline"));
			break;
		case RSNET_NETSTATE_BAD_NATSYM:
			label->setText(tr("NET BAD: Behind Symmetric NAT"));
			break;
		case RSNET_NETSTATE_BAD_NODHT_NAT:
			label->setText(tr("NET BAD: Behind NAT & No DHT"));
			break;
		case RSNET_NETSTATE_WARNING_RESTART:
			label->setText(tr("NET WARNING: NET Restart"));
			break;
		case RSNET_NETSTATE_WARNING_NATTED:
			label->setText(tr("NET WARNING: Behind NAT"));
			break;
		case RSNET_NETSTATE_WARNING_NODHT:
			label->setText(tr("NET WARNING: No DHT"));
			break;
		case RSNET_NETSTATE_GOOD:
			label->setText(tr("NET STATE GOOD!"));
			break;
		case RSNET_NETSTATE_ADV_FORWARD:
			label->setText(tr("CAUTION: UNVERIFIABLE FORWARD!"));
			break;
		case RSNET_NETSTATE_ADV_DARK_FORWARD:
			label->setText(tr("CAUTION: UNVERIFIABLE FORWARD & NO DHT"));
			break;
	}
}
// -------------------------------------------------------------------------------------------------
ParameterBox::ParameterBox(QWidget* parent, const char* name)
    throw () 
    : QFrame(parent, name), m_leftValue(-1.0), m_rightValue(-1.0)
{
    QGridLayout* layout = new QGridLayout(this, 5 /* row */, 9 /* col */, 0 /* margin */, 5);
    
    // - create ------------------------------------------------------------------------------------
    
    // settings
    Settings& set = Settings::set();
    
    // widgets
    QLabel* timeLabel = new QLabel(tr("&Measuring Time:"), this);
    QLabel* sampleLabel = new QLabel(tr("&Sampling Rate:"), this);
    QLabel* triggerLabel = new QLabel(tr("&Triggering:"), this);
    
    QTimeEdit* timeedit = new QTimeEdit(this);
    timeedit->setRange(QTime(0, 0), QTime(0, 1));
    QSlider* sampleSlider = new QSlider(0, MAX_SLIDER_VALUE, 1, 0, Qt::Horizontal, this);
    TriggerWidget* triggering = new TriggerWidget(this);
    
    // labels for the markers
    QLabel* leftMarkerLabel = new QLabel(tr("Left Button Marker:"), this);
    QLabel* rightMarkerLabel = new QLabel(tr("Right Button Marker:"), this);
    QLabel* diffLabel = new QLabel(tr("Difference:"), this);
    m_leftMarker = new QLabel(this);
    m_rightMarker = new QLabel(this);
    m_diff = new QLabel("zdddd", this);
    
    // set the font for the labels
    QFont font = qApp->font(this);
    font.setPixelSize(15);
    font.setBold(true);
    m_leftMarker->setFont(font);
    m_rightMarker->setFont(font);
    m_diff->setFont(font);
    
    // buddys
    timeLabel->setBuddy(timeedit);
    triggerLabel->setBuddy(triggering);
    sampleLabel->setBuddy(sampleSlider);
    
    // load value
    triggering->setValue(set.readNumEntry("Measuring/Triggering/Value"),
                         set.readNumEntry("Measuring/Triggering/Mask"));
    timeedit->setTime(QTime(0, set.readNumEntry("Measuring/Triggering/Minutes"),
                               set.readNumEntry("Measuring/Triggering/Seconds"))); 
    sampleSlider->setValue(MAX_SLIDER_VALUE - set.readNumEntry("Measuring/Number_Of_Skips"));
    
    // - layout the stuff --------------------------------------------------------------------------
                                   // row, col
    layout->addWidget(timeLabel,           0,    1);
    layout->addWidget(sampleLabel,         1,    1);
    layout->addWidget(triggerLabel,        2,    1,    Qt::AlignTop);
    layout->addWidget(timeedit,            0,    3);
    layout->addWidget(sampleSlider,        1,    3);
    layout->addMultiCellWidget(triggering, 2, 3, 3, 3);
    layout->addWidget(leftMarkerLabel,     0,    5);
    layout->addWidget(rightMarkerLabel,    1,    5);
    layout->addWidget(diffLabel,           2,    5);
    layout->addWidget(m_leftMarker,        0,    7,    Qt::AlignRight);
    layout->addWidget(m_rightMarker,       1,    7,    Qt::AlignRight);
    layout->addWidget(m_diff,              2,    7,    Qt::AlignRight);
    layout->setColStretch(0, 2);
    layout->setColSpacing(2, 20);
    layout->setColStretch(4, 4);
    layout->setColSpacing(6, 20);
    layout->setColSpacing(7, 150);
    layout->setColStretch(8, 2);
    
    connect(timeedit,                   SIGNAL(valueChanged(const QTime&)), 
            this,                       SLOT(timeValueChanged(const QTime&)));
    connect(triggering,                 SIGNAL(valueChanged(byte, byte)), 
            this,                       SLOT(triggerValueChanged(byte, byte)));
    connect(sampleSlider,               SIGNAL(valueChanged(int)),
            this,                       SLOT(sliderValueChanged(int)));
    
    // - initial values ----------------------------------------------------------------------------
    updateValues();
}
Esempio n. 8
0
Setup::Setup(QWidget *parent) : QDialog(parent) {

//	QMessageBox::information(this,"Need to Setup","This seems to be the first time you start Booker. You need to enter some important information.");

	QLabel *title = new QLabel("Setup Booker");
	title->setStyleSheet("font-weight: bold; font-size: 12pt");
	title->setAlignment(Qt::AlignCenter);

	Line *belowTitle = new Line;

	QLabel *dbLabel = new QLabel("Please enter here the database connection credentials:");
	dbLabel->setWordWrap(true);

	dbHost = new QLineEdit;
	dbDatabase = new QLineEdit;
	dbUsername = new QLineEdit;
	dbPassword = new QLineEdit;

	QFormLayout *dbLay = new QFormLayout;
	dbLay->addRow("Host:",dbHost);
	dbLay->addRow("Database:",dbDatabase);
	dbLay->addRow("Username:"******"Password:"******"Please enter here the three passwords. The office is the one known to everyone. The Encryption password is supposed to be kept secret and doesn't need to be entered again. The Master Password also doesn't need to be entered, except you want to change some of the configuration.");
	pwLabel->setWordWrap(true);

	pwMasterCheck = new QCheckBox("Master Password:"******"Office Password:"******"Encryption Password:"******"Okay");
	ok->setEnabled(false);
	can = new QPushButton("Quit");
	QHBoxLayout *butLay = new QHBoxLayout;
	butLay->addStretch();
	butLay->addWidget(ok);
	butLay->addWidget(can);
	butLay->addStretch();


	QVBoxLayout *lay = new QVBoxLayout;
	lay->addSpacing(5);
	lay->addWidget(title);
	lay->addSpacing(5);
	lay->addWidget(belowTitle);
	lay->addSpacing(5);
	lay->addWidget(dbLabel);
	lay->addSpacing(5);
	lay->addLayout(dbLay);
	lay->addSpacing(5);
	lay->addWidget(belowDb);
	lay->addSpacing(5);
	lay->addWidget(pwLabel);
	lay->addSpacing(5);
	lay->addLayout(pwLay);
	lay->addSpacing(5);
	lay->addWidget(belowPw);
	lay->addSpacing(5);
	lay->addLayout(butLay);

	this->setLayout(lay);


	connect(ok, SIGNAL(clicked()), this, SLOT(enter()));
	connect(can, SIGNAL(clicked()), this, SLOT(reject()));

}
Esempio n. 9
0
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget),
    m_pData(new Widget::Private())
{
    ui->setupUi(this);
    QComboBox *cityList = new QComboBox(this);
    cityList->addItem(tr("Beijing"), QLatin1String("Beijing, cn"));
    cityList->addItem(tr("Shanghai"), QLatin1String("Shanghai, cn"));
    cityList->addItem(tr("Nanjing"), QLatin1String("Nanjing, cn"));

    QLabel* cityLabel = new QLabel(tr("City:"), this);
    QPushButton *refreshButton = new QPushButton(tr("Refresh"), this);
    QHBoxLayout *cityListLayout = new QHBoxLayout;
    cityListLayout->setDirection(QBoxLayout::LeftToRight);
    cityListLayout->addWidget(cityLabel);
    cityListLayout->addWidget(cityList);
    cityListLayout->addWidget(refreshButton);

    QVBoxLayout *weatherLayout = new QVBoxLayout;
    weatherLayout->setDirection(QBoxLayout::TopToBottom);
    QLabel* cityNameLabel = new QLabel(this);
    weatherLayout->addWidget(cityNameLabel);
    QLabel *dateTimeLabel = new QLabel(this);
    weatherLayout->addWidget(dateTimeLabel);

    m_pData->descLabel = new QLabel(this);
    weatherLayout->addWidget(m_pData->descLabel);
    m_pData->iconLabel = new QLabel(this);
    weatherLayout->addWidget(m_pData->iconLabel);

    QVBoxLayout* mainLayout = new QVBoxLayout(this);
    mainLayout->addLayout(cityListLayout);
    mainLayout->addLayout(weatherLayout);
    resize(320, 120);
    setWindowTitle("Weather");

    connect(m_pData->network, &NetWorker::finished, [=](QNetworkReply* reply){
        switch(m_pData->replyMap.value(reply))
        {
        case FetchWeatherInfo:
            {
                QJsonParseError error;
                QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);

                if(error.error == QJsonParseError::NoError){
                    if(!(jsonDoc.isNull() || jsonDoc.isEmpty()) && (jsonDoc.isObject())){
                        QVariantMap data = jsonDoc.toVariant().toMap();
                        WeatherInfo weather;
                        weather.setCityName(data[QLatin1String("name")].toString());
                        QDateTime dateTime;
                        dateTime.setTime_t(data[QLatin1String("dt")].toLongLong());
                        weather.setDateTime(dateTime);
                        QVariantMap main = data[QLatin1String("main")].toMap();
                        weather.setTempertuare(main[QLatin1String("temp")].toFloat());
                        weather.setPressure(main[QLatin1String("pressure")].toFloat());
                        weather.setHumidity(main[QLatin1String("humidity")].toFloat());
                        QVariantList detaiList = data[QLatin1String("weather")].toList();
                        WeatherDetailList details;
                        foreach (QVariant w, detaiList) {
                            QVariantMap wm = w.toMap();
                            WeatherDetail *detail = new WeatherDetail;
                            detail->setDesc(wm[QLatin1String("description")].toString());
                            detail->setIcon(wm[QLatin1Literal("icon")].toString());
                            details.append(detail);
                        }
                        weather.setDetails(details);
                        cityNameLabel->setText(weather.cityName());
                        dateTimeLabel->setText(weather.dateTime().toString(Qt::DefaultLocaleLongDate));
                        m_pData->descLabel->setText(weather.details().at(0)->desc());
                        qDebug()<<weather;
                    }
                    else{
                        QMessageBox::critical(this, "Error","Parse Reply Error!");
                    }
                }
            }
CFullTestIOInWindow::CFullTestIOInWindow(QWidget *parent) :
    QWidget(parent)
{
    setProperty("testFlag",0);
    setProperty("init",0);
    setProperty("in",0);

    cf = ((CApp*)qApp)->_tjob->_mconfig;

    _ioItemCount = cf->_map_ioin.size();
    if(!property("init").toInt())
    {
        setProperty("init",1);
        QVBoxLayout *top = new QVBoxLayout;

        for(int i=0; i != _ioItemCount; ++i)
        {
            QLabel *_tempLabel = new QLabel;
            _tempLabel->setStyleSheet("border-radius:20px;background:#fff;border:1px solid #666;");
            _tempLabel->setFixedSize(40,40);
            _vec32IO.push_back(_tempLabel);
        }
        _testButton1 = new QPushButton(tr("检测低电平"));
        _testButton2 = new QPushButton(tr("检测高电平"));
        _statusLabel = new QLabel(tr("点击高低电平测试所有通道,点击圆圈发生检测单个通道。"));
        _statusLabel->setStyleSheet("font:bold 16px;color:#0099FF;max-height:26px;min-height:26px;background:#CCFF99;");
        _statusLabel_1 = new QLabel(tr("当前电平为:"));
        _statusLabel_1->setStyleSheet("font:bold 18px;color:#0099FF;max-height:30px;min-height:30px;background:#CCFF99;");
        _testButton1->setFocusPolicy(Qt::NoFocus);
        _testButton2->setFocusPolicy(Qt::NoFocus);
        _bReadCurrent = new QCheckBox("读取激励电流");
        _bReadCurrent->setFocusPolicy(Qt::NoFocus);

        //***Layout
        QGroupBox *_mainGroupBox = new QGroupBox(QString::number(_ioItemCount) + tr("路IO输入量测试"));
        QGridLayout *_mainGridLay = new QGridLayout(_mainGroupBox);

        _mainGridLay->addWidget(_statusLabel,0,0,1,8);
        _mainGridLay->addWidget(_statusLabel_1,1,0,1,8);
        for(int i=0; i != _ioItemCount; ++i)
        {
            QVBoxLayout *_tempVLay = new QVBoxLayout;
            int kk = ((CApp*)qApp)->_tjob->getIOInMapVoltage(i);
            QLabel *io = new QLabel( kk?tr("高电平有效"):tr("低电平有效") );
            if(kk)
                io->setStyleSheet("background-color:wheat;");
            else
                io->setStyleSheet("background-color:yellow;");

            _vec32IO[i]->installEventFilter(this);
            _tempVLay->addWidget(new QLabel("I/O量"+QString("%1").arg(i)));
            _tempVLay->addWidget(_vec32IO.at(i));
            _tempVLay->addWidget(io);

            _mainGridLay->addLayout(_tempVLay,i/8+2,i%8,1,1);

            if( ((CApp*)qApp)->_tjob->getIOInMapCurrent(i)!=-1 )
                _vec32IO[i]->setText(tr("电流"));
        }
        _mainGridLay->addWidget(_bReadCurrent,6,2,1,2);
        _mainGridLay->addWidget(_testButton1,6,4,1,2);
        _mainGridLay->addWidget(_testButton2,6,6,1,2);

        top->addWidget(_mainGroupBox);
        top->setSizeConstraint(QLayout::SetFixedSize);
        setLayout(top);

        //***Signal
        connect(_testButton1,SIGNAL(clicked()),this,SLOT(testButton1Clicked()));
        connect(_testButton2,SIGNAL(clicked()),this,SLOT(testButton2Clicked()));
        connect((CApp*)qApp,SIGNAL(sendBackFullTestData_ioi_485(QByteArray)),this,SLOT(sendBackData485(QByteArray)));
        connect((CApp*)qApp,SIGNAL(sendBackFullTestData_ioi_232(QByteArray)),this,SLOT(sendBackData232(QByteArray)));
    }
}
Esempio n. 11
0
GeoDialog::GeoDialog( QWidget *parent, const char *name )
    : KDialogBase( Plain, i18n( "Geo Data Input" ), Ok | Cancel, Ok,
                   parent, name, true, true ),
      mUpdateSexagesimalInput( true )
{
    QFrame *page = plainPage();

    QGridLayout *topLayout = new QGridLayout( page, 2, 2, marginHint(),
            spacingHint() );
    topLayout->setRowStretch( 1, 1 );

    mMapWidget = new GeoMapWidget( page );
    topLayout->addMultiCellWidget( mMapWidget, 0, 1, 0, 0 );

    mCityCombo = new KComboBox( page );
    topLayout->addWidget( mCityCombo, 0, 1 );

    QGroupBox *sexagesimalGroup = new QGroupBox( 0, Vertical, i18n( "Sexagesimal" ), page );
    QGridLayout *sexagesimalLayout = new QGridLayout( sexagesimalGroup->layout(),
            2, 5, spacingHint() );

    QLabel *label = new QLabel( i18n( "Latitude:" ), sexagesimalGroup );
    sexagesimalLayout->addWidget( label, 0, 0 );

    mLatDegrees = new QSpinBox( 0, 90, 1, sexagesimalGroup );
    mLatDegrees->setSuffix( "°" );
    mLatDegrees->setWrapping( false );
    label->setBuddy( mLatDegrees );
    sexagesimalLayout->addWidget( mLatDegrees, 0, 1 );

    mLatMinutes = new QSpinBox( 0, 59, 1, sexagesimalGroup );
    mLatMinutes->setSuffix( "'" );
    sexagesimalLayout->addWidget( mLatMinutes, 0, 2 );

    mLatSeconds = new QSpinBox( 0, 59, 1, sexagesimalGroup );
    mLatSeconds->setSuffix( "\"" );
    sexagesimalLayout->addWidget( mLatSeconds, 0, 3 );

    mLatDirection = new KComboBox( sexagesimalGroup );
    mLatDirection->insertItem( i18n( "North" ) );
    mLatDirection->insertItem( i18n( "South" ) );
    sexagesimalLayout->addWidget( mLatDirection, 0, 4 );

    label = new QLabel( i18n( "Longitude:" ), sexagesimalGroup );
    sexagesimalLayout->addWidget( label, 1, 0 );

    mLongDegrees = new QSpinBox( 0, 180, 1, sexagesimalGroup );
    mLongDegrees->setSuffix( "°" );
    label->setBuddy( mLongDegrees );
    sexagesimalLayout->addWidget( mLongDegrees, 1, 1 );

    mLongMinutes = new QSpinBox( 0, 59, 1, sexagesimalGroup );
    mLongMinutes->setSuffix( "'" );
    sexagesimalLayout->addWidget( mLongMinutes, 1, 2 );

    mLongSeconds = new QSpinBox( 0, 59, 1, sexagesimalGroup );
    mLongSeconds->setSuffix( "\"" );
    sexagesimalLayout->addWidget( mLongSeconds, 1, 3 );

    mLongDirection = new KComboBox( sexagesimalGroup );
    mLongDirection->insertItem( i18n( "East" ) );
    mLongDirection->insertItem( i18n( "West" ) );
    sexagesimalLayout->addWidget( mLongDirection, 1, 4 );

    topLayout->addWidget( sexagesimalGroup, 1, 1 );

    loadCityList();

    connect( mMapWidget, SIGNAL( changed() ),
             SLOT( geoMapChanged() ) );
    connect( mCityCombo, SIGNAL( activated( int ) ),
             SLOT( cityInputChanged() ) );
    connect( mLatDegrees, SIGNAL( valueChanged( int ) ),
             SLOT( sexagesimalInputChanged() ) );
    connect( mLatMinutes, SIGNAL( valueChanged( int ) ),
             SLOT( sexagesimalInputChanged() ) );
    connect( mLatSeconds, SIGNAL( valueChanged( int ) ),
             SLOT( sexagesimalInputChanged() ) );
    connect( mLatDirection, SIGNAL( activated( int ) ),
             SLOT( sexagesimalInputChanged() ) );
    connect( mLongDegrees, SIGNAL( valueChanged( int ) ),
             SLOT( sexagesimalInputChanged() ) );
    connect( mLongMinutes, SIGNAL( valueChanged( int ) ),
             SLOT( sexagesimalInputChanged() ) );
    connect( mLongSeconds, SIGNAL( valueChanged( int ) ),
             SLOT( sexagesimalInputChanged() ) );
    connect( mLongDirection, SIGNAL( activated( int ) ),
             SLOT( sexagesimalInputChanged() ) );

    KAcceleratorManager::manage( this );
}
/**
 * @brief MainWindow that displays the interface for the program.
 * @param parent parent widget of mainwindow = 0
 */
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowTitle("MilaOCRv1.0.0");

    // create all layouts
    QWidget* main_window=new QWidget;//create a central widget
    QVBoxLayout* vlayout1 = new QVBoxLayout;//main layout for application
    QHBoxLayout* hlayout1 = new QHBoxLayout;//create top horizontal layout, for buttons
    QHBoxLayout* hlayout2 = new QHBoxLayout;//middle horiz layout, img + text boxes
    QHBoxLayout* hlayout3 = new QHBoxLayout;//bottom horiz layout, export button
    QVBoxLayout* vlayout2 = new QVBoxLayout;//layout for file and ocr buttons

    QLabel* header = new QLabel("<h3>MilaOCR</h3>");
    QPixmap pic(":/Image/MilaOCR.png");
    //to set buttons as icons with pictures
    //QPixmap import_pic(":/Image/importfile.png");
    //QPixmap export_pic(":/Image/export.png");
    //QIcon export_icon(export_pic);
    //QIcon import_icon(import_pic);
    header->setPixmap(pic);
    header->setAlignment(Qt::AlignCenter);
    QPushButton* openFileButton = new QPushButton("Choose File");//open file button
    openFileButton->setFixedWidth(150);
    //openFileButton->setFont(QFont::);
    //openFileButton->setIcon(import_icon);
    //openFileButton->setIconSize(import_pic.size());
    //set tooltip
    openFileButton->setToolTip("Max file size: 1MB");
    QPushButton* performOCR = new QPushButton("Perform OCR");//perform OCR button
    performOCR->setFixedWidth(150);
    //set tooltip
    performOCR->setToolTip("Click to perform OCR and see results");
    QPushButton* exportToFile = new QPushButton("Export");//export button
    exportToFile->setFixedWidth(100);
    //exportToFile->setIcon(export_icon);
    //exportToFile->setIconSize(export_pic.size());
    //set tooltip
    exportToFile->setToolTip("Save the results to a text file");

    //Qlabels to hold OCR image and OCR'd text
    displayImage->setStyleSheet("border: 1.4px solid black");
    displayImage->setFixedSize(350,400);
    displayImage->setScaledContents(true);
    displayText->setStyleSheet("border: 1.4px solid black");
    displayText->setFixedSize(350,400);
    displayText->setScaledContents(true);

    //set signals and slots for buttons
    QObject::connect(openFileButton,SIGNAL(clicked()),this,SLOT(chooseFile()));
    QObject::connect(performOCR,SIGNAL(clicked()),this,SLOT(recognize()));
    QObject::connect(exportToFile,SIGNAL(clicked()),this,SLOT(saveToFile()));

    //add everything to layouts
    vlayout2->addWidget(openFileButton);
    vlayout2->addWidget(performOCR);
    hlayout2->addWidget(displayImage);
    hlayout2->addLayout(vlayout2);
    hlayout2->addWidget(displayText);
    hlayout3->addWidget(exportToFile);
    hlayout3->setAlignment(Qt::AlignRight);

    //add everything to main layout
    vlayout1->addWidget(header);
    vlayout1->addLayout(hlayout1);
    vlayout1->addLayout(hlayout2);
    vlayout1->addLayout(hlayout3);
    main_window->setLayout(vlayout1);
    //set central widget
    this->setCentralWidget(main_window);
}
Esempio n. 13
0
void SettingsWindow::genCustomise()
{
    QLabel *lblBgColor = new QLabel(tr("Background color"));
    lblBgColor->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    editBgColor = new QLineEdit;
    editBgColor->setEnabled(false);
    editBgColor->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
    QToolButton *btnBgColor = new QToolButton;
    btnBgColor->setText(tr("Change color"));
    btnBgColor->setIcon(QIcon(":/img/config.png"));
    btnBgColor->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    btnBgColor->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    connect(btnBgColor,SIGNAL(clicked()),this,SLOT(chooseColor()));

    QLabel *lblBgImageMain = new QLabel(tr("Background image of the main window"));
    editBgImageMain = new QLineEdit;
    editBgImageMain->setEnabled(false);
    editBgImageMain->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
    btnBgImageMain = new QToolButton;
    btnBgImageMain->setText(tr("Explore"));
    btnBgImageMain->setIcon(QIcon(":/img/config.png"));
    btnBgImageMain->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    btnBgImageMain->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    connect(btnBgImageMain,SIGNAL(clicked()),this,SLOT(chooseBgImage()));

    QLabel *lblBgImageLock = new QLabel(tr("Background image of the lock screen"));
    editBgImageLock = new QLineEdit;
    editBgImageLock->setEnabled(false);
    editBgImageLock->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
    btnBgImageLock = new QToolButton;
    btnBgImageLock->setText(tr("Explore"));
    btnBgImageLock->setIcon(QIcon(":/img/config.png"));
    btnBgImageLock->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    btnBgImageLock->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    connect(btnBgImageLock,SIGNAL(clicked()),this,SLOT(chooseBgImage()));

    QLabel *lblAnimation = new QLabel(tr("Animations Effects / Transitions"));
    checkAnimation = new QCheckBox(tr("Enable"));
    checkAnimation->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);

    QGridLayout *layCustomise = new QGridLayout;
    layCustomise->setContentsMargins(10,10,10,10);
    layCustomise->setSpacing(10);

    layCustomise->addWidget(lblAnimation,0,0);
    layCustomise->addWidget(checkAnimation,0,1,1,2);

    layCustomise->addWidget(lblBgColor,1,0);
    layCustomise->addWidget(editBgColor,1,1);
    layCustomise->addWidget(btnBgColor,1,2);

    layCustomise->addWidget(lblBgImageMain,2,0);
    layCustomise->addWidget(editBgImageMain,2,1);
    layCustomise->addWidget(btnBgImageMain,2,2);

    layCustomise->addWidget(lblBgImageLock,3,0);
    layCustomise->addWidget(editBgImageLock,3,1);
    layCustomise->addWidget(btnBgImageLock,3,2);

    QGroupBox *boxCustomize = new QGroupBox(tr("Customize"));
    boxCustomize->setLayout(layCustomise);

    // ----------------------------

    previewBgImageMain = new QToolButton;
    previewBgImageMain->setText(tr("Background image of the main window"));
    previewBgImageMain->setIconSize(QSize(400,300));
    previewBgImageMain->setIcon(QIcon(":/img/file.png"));
    previewBgImageMain->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    previewBgImageMain->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
    connect(previewBgImageMain,SIGNAL(clicked()),this,SLOT(chooseBgImage()));

    previewBgImageLock = new QToolButton;
    previewBgImageLock->setText(tr("Background image of the lock screen"));
    previewBgImageLock->setIconSize(QSize(400,300));
    previewBgImageLock->setIcon(QIcon(":/img/file.png"));
    previewBgImageLock->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    previewBgImageLock->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
    connect(previewBgImageLock,SIGNAL(clicked()),this,SLOT(chooseBgImage()));

    QGridLayout *layBgImageMain = new QGridLayout;
    layBgImageMain->setContentsMargins(10,10,10,10);
    layBgImageMain->setSpacing(10);

    layBgImageMain->addWidget(previewBgImageMain,0,0);
    layBgImageMain->addWidget(previewBgImageLock,0,1);

    HideBlock *boxBgImage = new HideBlock(tr("Background images preview"));
    boxBgImage->setBlockLayout(layBgImageMain);

    // ----------------------------

    QWidget *spacer = new QWidget;
    spacer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->setSpacing(0);
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->addWidget(boxCustomize,0,0);
    mainLayout->addWidget(boxBgImage,1,0);
    mainLayout->addWidget(spacer,2,0);

    tabCustomise = new SettingsPanel;
    tabCustomise->setTitle(tr("Customise"));
    tabCustomise->setMainLayout(mainLayout);
}
Esempio n. 14
0
void SettingsWindow::genNavigation()
{
    radioEmptyStartup = new QRadioButton(tr("Show empty page"));
    radioHomeStartup = new QRadioButton(tr("Show home page"));
    radioSpecificStartup = new QRadioButton(tr("Show specific page"));
    editSpecificStartup = new QLineEdit;
    editSpecificStartup->hide();

    QGridLayout *layStartup = new QGridLayout;
    layStartup->setContentsMargins(10,10,10,10);
    layStartup->setSpacing(10);

    layStartup->addWidget(radioEmptyStartup,0,0);
    layStartup->addWidget(radioHomeStartup,1,0);
    layStartup->addWidget(radioSpecificStartup,2,0);
    layStartup->addWidget(editSpecificStartup,3,1);

    connect(radioSpecificStartup,SIGNAL(toggled(bool)),editSpecificStartup,SLOT(setVisible(bool)));

    HideBlock *boxStartup = new HideBlock(tr("At startup"));
    boxStartup->setBlockLayout(layStartup);

    // -----------------------------------------

    radioEmptyNewTab = new QRadioButton(tr("Show empty page"));
    radioHomeNewTab = new QRadioButton(tr("Show home page"));
    radioSpecificNewTab = new QRadioButton(tr("Show specific page"));
    editSpecificNewTab = new QLineEdit;
    editSpecificNewTab->hide();

    QGridLayout *layNewTab = new QGridLayout;
    layNewTab->setContentsMargins(10,10,10,10);
    layNewTab->setSpacing(10);

    layNewTab->addWidget(radioEmptyNewTab,0,0);
    layNewTab->addWidget(radioHomeNewTab,1,0);
    layNewTab->addWidget(radioSpecificNewTab,2,0);
    layNewTab->addWidget(editSpecificNewTab,3,1);

    connect(radioSpecificNewTab,SIGNAL(toggled(bool)),editSpecificNewTab,SLOT(setVisible(bool)));

    HideBlock *boxNewTab = new HideBlock(tr("When I open a new tab"));
    boxNewTab->setBlockLayout(layNewTab);

    // -----------------------------------------

    QLabel *lblHomePage = new QLabel(tr("Home page"));
    lblHomePage->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    editHomePage = new QLineEdit;

    QLabel *lblSearchUrl = new QLabel(tr("Search URL"));
    editPrefixSearchUrl = new QLineEdit;
    QLabel *lblSearch = new QLabel(tr("search words"));
    editSuffixSearchUrl = new QLineEdit;

    QGridLayout *layNavigationUrl = new QGridLayout;
    layNavigationUrl->setContentsMargins(10,10,10,10);
    layNavigationUrl->setSpacing(10);
    layNavigationUrl->addWidget(lblHomePage,0,0);
    layNavigationUrl->addWidget(editHomePage,0,1,1,3);

    layNavigationUrl->addWidget(lblSearchUrl,1,0);
    layNavigationUrl->addWidget(editPrefixSearchUrl,1,1);
    layNavigationUrl->addWidget(lblSearch,1,2);
    layNavigationUrl->addWidget(editSuffixSearchUrl,1,3);

    QGroupBox *boxNavigationUrl = new QGroupBox(tr("URL Navigations"));
    boxNavigationUrl->setLayout(layNavigationUrl);

    // -------------------------------------

    // GrpBox Navigation (normal/private/perso)

    // ---------------------------------------

    QWidget *spacer = new QWidget;
    spacer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->setSpacing(0);
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->addWidget(boxNavigationUrl);
    mainLayout->addWidget(boxStartup);
    mainLayout->addWidget(boxNewTab);
    mainLayout->addWidget(spacer);

    tabNavigation = new SettingsPanel;
    tabNavigation->setTitle(tr("Navigation"));
    tabNavigation->setMainLayout(mainLayout);
}
Esempio n. 15
0
mainWindow::mainWindow()
{
    this->resize(440, 280);
    setWindowFlags(Qt::FramelessWindowHint);
    QLabel *background = new QLabel(this);
    background->setStyleSheet("background-color:lightblue");
    background->setGeometry(0,0,this->width(),this->height());

    int width = this->width();
    QToolButton *minButton = new QToolButton(this);
    QToolButton *closeButton = new QToolButton(this);

    connect(minButton,SIGNAL(clicked()),this,SLOT(showMinimized()));
    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));

    minButton->setGeometry(width-50,5,20,20);
    closeButton->setGeometry(width-25,5,20,20);

    QPixmap minPix = style()->standardPixmap(QStyle::SP_TitleBarMinButton);
    QPixmap closePix = style()->standardPixmap(QStyle::SP_TitleBarCloseButton);

    minButton->setIcon(minPix);
    closeButton->setIcon(closePix);
    minButton->setToolTip(tr("最小化"));
    closeButton->setToolTip(tr("关闭"));

    minButton->setStyleSheet("background-color:transparent");
    closeButton->setStyleSheet("background-color:transparent;");

    nickNameLabel.setParent(this);      //昵称处
    nickNameLabel.setGeometry(QRect(30, 10, 50, 25));
    nickNameLabel.setText("昵称");
    tipLabel.setParent(this);       //建议框
    tipLabel.setGeometry(QRect(100, 10, 220, 25));
    tipLabel.setText("您今天背诵了XX个单词");
    time.setParent(this);
    time.setGeometry(320, 10, 60, 25);
    QTimer *timer1 = new QTimer(this);
    timer1->start(1000);
    connect(timer1, SIGNAL(timeout()), this, SLOT(tim_slot()));
    inquireEdit.setParent(this);    //查询区
    inquireEdit.setGeometry(QRect(40, 60, 280, 30));
    inquireEdit.setText("请输入要查询的文本");
    inquireEdit.setFocus();
    search.setParent(this);         //搜索按钮
    search.setGeometry(QRect(330, 60, 100, 30));
    search.setText("开始查询");
    dayEnglish_1.setParent(this);   //每日英语
    dayEnglish_1.setGeometry(QRect(0, 100, 160, 220));
    dayEnglish_1.setWordWrap(true);
    dayEnglish_1.setAlignment(Qt::AlignTop);
    dayEnglish_1.setText("每\n日\n英\n语\n区");
    dayEnglish_1.setStyleSheet("background-color:lightgreen");
    wordEnglish_2.setParent(this);  //单词专区
    wordEnglish_2.setGeometry(QRect(160, 100,160, 220));
    wordEnglish_2.setWordWrap(true);
    wordEnglish_2.setAlignment(Qt::AlignTop);
    wordEnglish_2.setText("英\n语\n单\n词\n区");
    wordEnglish_2.setStyleSheet("background-color:lightyellow");
    testEnglish_3.setParent(this);  //测试专区
    testEnglish_3.setGeometry(QRect(320, 100, 160, 220));
    testEnglish_3.setWordWrap(true);
    testEnglish_3.setAlignment(Qt::AlignTop);
    testEnglish_3.setStyleSheet("background-color:purple");
    testEnglish_3.setText("英\n语\n测\n试\n区");
}
Esempio n. 16
0
MainDialog::MainDialog(QWidget *parent)
    : QDialog(parent)
    , mHostEdit(new QLineEdit)
    , mPortEdit(new QLineEdit)
    , mUserEdit(new QLineEdit)
    , mPswdEdit(new QLineEdit)
    , mLAddrEdit(new QLineEdit)
    , mLPortEdit(new QLineEdit)
    , mWaitEdit(new QLineEdit)
    , mCtrlBtn(new QPushButton(tr("Start")))
    , mQuitBtn(new QPushButton(tr("Quit")))
    , mLogList(new QListWidget)
    , mInfoIcon(QPixmap(":/icon-info.png"))
    , mWarnIcon(QPixmap(":/icon-warn.png"))
    , mErrorIcon(QPixmap(":/icon-error.png"))
    , mStoppedIcon(QPixmap(":/icon-stopped.png"))
    , mConnectingIcon(QPixmap(":/icon-connecting.png"))
    , mConnectedIcon(QPixmap(":/icon-connected.png"))
    , mSleepingIcon(QPixmap(":/icon-sleeping.png"))
    , mSettings(new QSettings(QSettings::IniFormat, QSettings::UserScope,
                              "glacjay", "sshproxy", this))
    , mIsKeepRunning(false)
    , mProcess(new QProcess(this))
    , mRestartTimer(new QTimer(this))
{
    setWindowTitle(tr("SSH Proxy"));
    setWindowIcon(mConnectedIcon);

    mHostEdit->setText(mSettings->value("ssh/host").toString());
    mPortEdit->setText(mSettings->value("ssh/port", "22").toString());
    mUserEdit->setText(mSettings->value("ssh/user").toString());
    mLAddrEdit->setText(mSettings->value("ssh/laddr", "127.0.0.1").toString());
    mLPortEdit->setText(mSettings->value("ssh/lport", "1077").toString());
    mWaitEdit->setText(mSettings->value("ssh/wait", "10").toString());

    mPortEdit->setValidator(new QIntValidator(1, 65535));
    mPswdEdit->setEchoMode(QLineEdit::Password);
    mLPortEdit->setValidator(new QIntValidator(1, 65535));
    mWaitEdit->setValidator(new QIntValidator);
    mLogList->setWordWrap(true);

    mProcess->setProcessChannelMode(QProcess::MergedChannels);

    QLabel *hostLabel = new QLabel(tr("SSH Host:"));
    hostLabel->setBuddy(mHostEdit);
    QLabel *portLabel = new QLabel(tr("SSH Port:"));
    portLabel->setBuddy(mPortEdit);
    QLabel *userLabel = new QLabel(tr("Username:"******"Password:"******"Listen Addr:"));
    lAddrLabel->setBuddy(mLAddrEdit);
    QLabel *lPortLabel = new QLabel(tr("Listen Port:"));
    lPortLabel->setBuddy(mLPortEdit);
    QLabel *waitLabel = new QLabel(tr("Seconds wait to reconnect:"));
    waitLabel->setBuddy(mWaitEdit);

    QVBoxLayout *inputLayout = new QVBoxLayout;
    inputLayout->addWidget(hostLabel);
    inputLayout->addWidget(mHostEdit);
    inputLayout->addWidget(portLabel);
    inputLayout->addWidget(mPortEdit);
    inputLayout->addWidget(userLabel);
    inputLayout->addWidget(mUserEdit);
    inputLayout->addWidget(pswdLabel);
    inputLayout->addWidget(mPswdEdit);
    inputLayout->addWidget(lAddrLabel);
    inputLayout->addWidget(mLAddrEdit);
    inputLayout->addWidget(lPortLabel);
    inputLayout->addWidget(mLPortEdit);
    inputLayout->addWidget(waitLabel);
    inputLayout->addWidget(mWaitEdit);
    inputLayout->insertStretch(-1);
    inputLayout->addWidget(mCtrlBtn);
    inputLayout->addWidget(mQuitBtn);

    QGroupBox *inputGroup = new QGroupBox(tr("Settings"));
    inputGroup->setLayout(inputLayout);

    QVBoxLayout *logLayout = new QVBoxLayout;
    logLayout->addWidget(mLogList);

    QGroupBox *logGroup = new QGroupBox(tr("Log"));
    logGroup->setLayout(logLayout);

    QSplitter *splitter = new QSplitter(Qt::Horizontal);
    splitter->addWidget(inputGroup);
    splitter->addWidget(logGroup);
    splitter->setStretchFactor(1, 5);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(splitter);

    setLayout(mainLayout);
    resize(1000, 600);

    connect(mCtrlBtn, SIGNAL(clicked(void)), this, SLOT(on_mCtrlBtn_clicked(void)));
    connect(mQuitBtn, SIGNAL(clicked(void)), this, SLOT(onQuit(void)));

    mTray = new QSystemTrayIcon(mStoppedIcon);
    mTray->show();

    setSshStatus(StatStopped);

    connect(mTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(on_mTray_activated(QSystemTrayIcon::ActivationReason)));

    QAction *toggleAction = new QAction(tr("Toggle Main Dialog"), this);
    connect(toggleAction, SIGNAL(triggered(void)),
            this, SLOT(on_toggleAction_triggered(void)));

    QAction *quitAction = new QAction(tr("Quit"), this);
    connect(quitAction, SIGNAL(triggered(void)),
            this, SLOT(onQuit(void)));

    QMenu *trayMenu = new QMenu;
    trayMenu->addAction(toggleAction);
    trayMenu->addSeparator();
    trayMenu->addAction(quitAction);

    mTray->setContextMenu(trayMenu);

    connect(qApp, SIGNAL(aboutToQuit(void)), this, SLOT(onQuit(void)));

    connect(mProcess, SIGNAL(started(void)), this, SLOT(on_mProcess_started(void)));
    connect(mProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
            this, SLOT(on_mProcess_finished(int, QProcess::ExitStatus)));
    connect(mProcess, SIGNAL(error(QProcess::ProcessError)),
            this, SLOT(on_mProcess_error(QProcess::ProcessError)));
    connect(mProcess, SIGNAL(readyReadStandardOutput(void)),
            this, SLOT(on_mProcess_readyReadStandardOutput(void)));

    connect(mRestartTimer, SIGNAL(timeout(void)), this, SLOT(startRunning(void)));

    if (mHostEdit->text().isEmpty())
        mHostEdit->setFocus();
    else if (mPortEdit->text().isEmpty())
        mPortEdit->setFocus();
    else if (mUserEdit->text().isEmpty())
        mUserEdit->setFocus();
    else if (mPswdEdit->text().isEmpty())
        mPswdEdit->setFocus();
    else if (mLAddrEdit->text().isEmpty())
        mLAddrEdit->setFocus();
    else if (mLPortEdit->text().isEmpty())
        mLPortEdit->setFocus();
    else if (mWaitEdit->text().isEmpty())
        mWaitEdit->setFocus();
}
Esempio n. 17
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),font("Times",22),pause(true),secondsLeft(60)
{
    ui->setupUi(this);
    QScroller::grabGesture(ui->scrollArea->viewport(), QScroller::LeftMouseButtonGesture );

    timer = new QTimer(this);
    timer->setInterval(1000);
    connect(timer,SIGNAL(timeout()),this,SLOT(minusSecond()));
    connect(this,SIGNAL(timeIsLeft()),this,SLOT(handleMafiaAgreement()));
    QStringList avaibleRoles;
    avaibleRoles.push_back("");
    avaibleRoles.push_back("Citizen");
    avaibleRoles.push_back("Sherif");
    avaibleRoles.push_back("Don");
    avaibleRoles.push_back("Mafia");

    QStringList avaibleForVote;
    avaibleForVote.push_back(NOBODY);
    for (int i=1;i<=10;i++)
        avaibleForVote.push_back(QString("%1").arg(i));

    QList<QComboBox*> rolesComboBoxes;
    QList<QComboBox*> votesComboBoxes;
    for (int i=0;i<10;i++)
    {
        rolesComboBoxes.push_back(new QComboBox(this));
        rolesComboBoxes.back()->setMinimumHeight(MIN_HEIGHT);
        rolesComboBoxes.back()->setMinimumWidth(MIN_COMBOBOX_WIDTH);
        rolesComboBoxes.back()->addItems(avaibleRoles);
        rolesComboBoxes.back()->setFont(font);

        votesComboBoxes.push_back(new QComboBox(this));
        votesComboBoxes.back()->setMinimumHeight(MIN_HEIGHT);
        votesComboBoxes.back()->setMinimumWidth(MIN_COMBOBOX_WIDTH);
        votesComboBoxes.back()->addItems(avaibleForVote);
        votesComboBoxes.back()->setFont(font);
        votesComboBoxes.back()->setStyleSheet("alignment: right;");
        for (int j=0;j<10;j++)
            votesComboBoxes.back()->setItemData(j,Qt::AlignHCenter, Qt::TextAlignmentRole);


        warningButtons.push_back(new WarningButton);
        warningButtons.back()->setMinimumHeight(MIN_HEIGHT);
        warningButtons.back()->setMinimumWidth(MIN_WARNING_BUTTON_WIDTH);
        warningButtons.back()->setFont(font);

        names.push_back(new QLineEdit(this));
        names.back()->setMinimumHeight(MIN_HEIGHT);
        names.back()->setFont(font);

        players.push_back(new Player(rolesComboBoxes.back(),votesComboBoxes.back(),names.back(),warningButtons.back(), i + 1));

        ui->verticalLayout->addWidget(names.back());
        ui->verticalLayout_2->addWidget(rolesComboBoxes.back());
        ui->verticalLayout_3->addWidget(votesComboBoxes.back());
        ui->verticalLayout_4->addWidget(warningButtons.back());
    }
    currentSpeaker = players.begin();


    for (int i = 0; i < players.size(); i++)
    {
        connect(warningButtons[i],SIGNAL(scored4warnings()),players[i],SLOT(die()));
    }

    for (int i = 0; i < names.size() - 1; i++)
        connect(names[i],SIGNAL(returnPressed()),names[i+1],SLOT(setFocus()));

    wasRevoting = false;
    roleBoxController = new RoleBoxController(rolesComboBoxes,players,this);
    voteBoxController = new VoteBoxController(votesComboBoxes,players,this);
    QTime Ti; Ti=QTime::currentTime();
    QDate D; D=QDate::currentDate();
    //QString path = D.toString().append("_").append(Ti.toString()).append(".txt");
    QString path = "log.txt";
    logger            = new Logger(path,players,this);
    for (int i = 1; i <= 10; i++)
    {
        QLabel* label = new QLabel(QString("<html><head/><body><p><span style=\" font-size:22pt;\">%1</span></p>").arg(i));
        ui->verticalLayout_6->addWidget(label);
        label->setMinimumHeight(MIN_HEIGHT);
    }
    ui->pushButton_11->setMinimumHeight(MIN_HEIGHT);
    ui->pushButton_15->setMinimumHeight(MIN_HEIGHT);

    connect(roleBoxController,SIGNAL(rolesAreDefined()),this,SLOT(rolesAreDefined()));
    voteBoxController->setEnabled(false);
    ui->pushButton_15->setEnabled(false);
    ui->pushButton_11->setEnabled(false);
}
Esempio n. 18
0
void MapIndicator::update_ind(Gamestate* actual)
{

    QJsonArray mapObj = actual->mapObj.array();
    int player = -1;
    bool playerTank = 0;

    float mapW = actual->mapInfo.object()["map_max"].toArray()[0].toDouble() - actual->mapInfo.object()["map_min"].toArray()[0].toDouble();
    float mapH = actual->mapInfo.object()["map_max"].toArray()[1].toDouble() - actual->mapInfo.object()["map_min"].toArray()[1].toDouble();

    for (int i =0; i<mapObj.size(); ++i)
    {
        if(mapObj[i].toObject()["icon"].toString() == QString("Player"))
        {
            player = i;
            if(mapObj[i].toObject()["type"].toString()==QString("ground_model"))
            {
                playerTank = 1;
            }
            break;
        }

    }



    if(mapObj.isEmpty() or player==-1 or (!playerTank and overlay))
    {
        mapValid = false;
        this->hide();

    }
    else if ((!overlay) or playerTank)
    {
        if(mapValid==false)
        {
            if(this->overlay)
            {
                QPixmap n(text.size());
                n.fill(QColor(0,0,0,0));
                text.setPixmap(n);
                cout << "Setting empty pixmap"<<endl;
            }
            else
            {

                QUrl url(dynamic_cast<InstrumentPanel*>(this->parent())->settings["url"].toString()+QString("/map.img"));
                QNetworkRequest request(url);
                cout << "Downloading image " << request.url().toString().toStdString()<<endl;
                manager->get(request);
            }


        }
        //cout << "Painting map Object!"<<endl;
        double playerX = mapObj[player].toObject()["x"].toDouble();
        double playerY = mapObj[player].toObject()["y"].toDouble();

        qDeleteAll(mapObjects->findChildren<QLabel*>());

        for (int i =0; i<mapObj.size(); ++i)
        {

           QLabel* obj; ;

           double x = mapObj[i].toObject()["x"].toDouble();
           double y = mapObj[i].toObject()["y"].toDouble();
           int mapX = x*this->size().width();
           int mapY =  y*this->size().height();
           int dist = sqrt((x-playerX)*mapW*(x-playerX)*mapW+(y-playerY)*mapH*(y-playerY)*mapW);
           //cout << dist<<endl;
            QWidget* obscure =  mapObjects->childAt(mapX, mapY);
           int obscureX = text.fontMetrics().size(Qt::TextSingleLine, "00").width();
           int obscureY = text.fontMetrics().size(Qt::TextSingleLine, "00").height();
           QWidget* obscure2 =  mapObjects->childAt(mapX+obscureX, mapY+obscureY);
           QWidget* obscure3 =  mapObjects->childAt(mapX-obscureX, mapY-obscureY);
           QWidget* obscure4 =  mapObjects->childAt(mapX-obscureX, mapY+obscureY);
           QWidget* obscure5 =  mapObjects->childAt(mapX+obscureX, mapY-obscureY);

           if(!(obscure or obscure2 or obscure3 or obscure4 or obscure5))
           {
               obj = new QLabel(mapObjects);
               obj->setText( QString::number(dist));
               if(this->size().width()>400  and params["scaling_text"].toBool())
               {
                   QFont ff = obj->font();
                   ff.setPixelSize(this->size().width()/26);
                   obj->setFont(ff);
               }

               obj->move(mapX, mapY);
               obj->show();


           }

           if(!overlay)
           {
               obj = new QLabel(mapObjects);
               if( mapObj[i].toObject()["icon_bg"].toString().indexOf("Target")>-1)
               {
                   obj->setStyleSheet(QString("QLabel { color: gold}"));
               }
               else
               {
                obj->setStyleSheet(QString("QLabel { color: ") + mapObj[i].toObject()["color"].toString()+QString("}"));
               }

               if(mapObj[i].toObject()["type"].toString() == QString("aircraft"))
               {
                    obj->setText("^");
               }
               else if(mapObj[i].toObject()["type"].toString() == QString("ground_model"))
               {
                    obj->setText("=");
               }

               if(mapObj[i].toObject()["icon"].toString() == QString("Player"))
               {
                     obj->setText("o");
                     obj->setStyleSheet(QString("QLabel { font: bold; color: green}"));
               }
               if(this->size().width()>400 and params["scaling_text"].toBool())
               {
                   QFont ff = obj->font();
                   ff.setPixelSize(this->size().width()/26);
                   obj->setFont(ff);
               }




               //obj->setStyleSheet(QString("QLabel { color: ") + mapObj[i].toObject()["color"].toString()+QString("}"));

               obj->move(mapX-obj->fontMetrics().size(Qt::TextSingleLine, "0").height()/2, mapY-obj->fontMetrics().size(Qt::TextSingleLine, "0").height()/2);
               obj->show();
           }

           /*if( mapObj[i].toObject()["icon_bg"].toString().indexOf("Target")>-1)
           {
               obj = new QLabel(mapObjects);
               obj->setText( QString("Target distance: ")+QString::number(dist));
              // obj->setStyleSheet(QString("QLabel { color: ") + mapObj[i].toObject()["color"].toString()+QString("}"));

               obj->move(0,0);
               obj->show();

               obj->setStyleSheet(QString("QLabel { font: bold 15px; color: red}"));
               obj->resize(obj->sizeHint());
           }*/

        }
        mapObjects->raise();
        this->show();
        mapValid = true;

    }
}
Esempio n. 19
0
EditACLEntryDialog::EditACLEntryDialog(KACLListView *listView, KACLListViewItem *item, const QStringList &users, const QStringList &groups,
                                       const QStringList &defaultUsers, const QStringList &defaultGroups, int allowedTypes, int allowedDefaultTypes,
                                       bool allowDefaults)
    : KDialogBase(listView, "edit_entry_dialog", true, i18n("Edit ACL Entry"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, false)
    , m_listView(listView)
    , m_item(item)
    , m_users(users)
    , m_groups(groups)
    , m_defaultUsers(defaultUsers)
    , m_defaultGroups(defaultGroups)
    , m_allowedTypes(allowedTypes)
    , m_allowedDefaultTypes(allowedDefaultTypes)
    , m_defaultCB(0)
{
    QWidget *page = new QWidget(this);
    setMainWidget(page);
    QVBoxLayout *mainLayout = new QVBoxLayout(page, 0, spacingHint(), "mainLayout");
    m_buttonGroup = new QVButtonGroup(i18n("Entry Type"), page, "bg");

    if(allowDefaults)
    {
        m_defaultCB = new QCheckBox(i18n("Default for new files in this folder"), page, "defaultCB");
        mainLayout->addWidget(m_defaultCB);
        connect(m_defaultCB, SIGNAL(toggled(bool)), this, SLOT(slotUpdateAllowedUsersAndGroups()));
        connect(m_defaultCB, SIGNAL(toggled(bool)), this, SLOT(slotUpdateAllowedTypes()));
    }

    mainLayout->addWidget(m_buttonGroup);

    QRadioButton *ownerType = new QRadioButton(i18n("Owner"), m_buttonGroup, "ownerType");
    m_buttonGroup->insert(ownerType, KACLListView::User);
    QRadioButton *owningGroupType = new QRadioButton(i18n("Owning Group"), m_buttonGroup, "owningGroupType");
    m_buttonGroup->insert(owningGroupType, KACLListView::Group);
    QRadioButton *othersType = new QRadioButton(i18n("Others"), m_buttonGroup, "othersType");
    m_buttonGroup->insert(othersType, KACLListView::Others);
    QRadioButton *maskType = new QRadioButton(i18n("Mask"), m_buttonGroup, "maskType");
    m_buttonGroup->insert(maskType, KACLListView::Mask);
    QRadioButton *namedUserType = new QRadioButton(i18n("Named User"), m_buttonGroup, "namesUserType");
    m_buttonGroup->insert(namedUserType, KACLListView::NamedUser);
    QRadioButton *namedGroupType = new QRadioButton(i18n("Named Group"), m_buttonGroup, "namedGroupType");
    m_buttonGroup->insert(namedGroupType, KACLListView::NamedGroup);

    connect(m_buttonGroup, SIGNAL(clicked(int)), this, SLOT(slotSelectionChanged(int)));

    m_widgetStack = new QWidgetStack(page);
    mainLayout->addWidget(m_widgetStack);

    QHBox *usersBox = new QHBox(m_widgetStack);
    m_widgetStack->addWidget(usersBox, KACLListView::NamedUser);

    QHBox *groupsBox = new QHBox(m_widgetStack);
    m_widgetStack->addWidget(groupsBox, KACLListView::NamedGroup);

    QLabel *usersLabel = new QLabel(i18n("User: "******"users");
    usersLabel->setBuddy(m_usersCombo);

    QLabel *groupsLabel = new QLabel(i18n("Group: "), groupsBox);
    m_groupsCombo = new QComboBox(false, groupsBox, "groups");
    groupsLabel->setBuddy(m_groupsCombo);

    if(m_item)
    {
        m_buttonGroup->setButton(m_item->type);
        if(m_defaultCB)
            m_defaultCB->setChecked(m_item->isDefault);
        slotUpdateAllowedTypes();
        slotSelectionChanged(m_item->type);
        slotUpdateAllowedUsersAndGroups();
        if(m_item->type == KACLListView::NamedUser)
        {
            m_usersCombo->setCurrentText(m_item->qualifier);
        }
        else if(m_item->type == KACLListView::NamedGroup)
        {
            m_groupsCombo->setCurrentText(m_item->qualifier);
        }
    }
    else
    {
        // new entry, preselect "named user", arguably the most common one
        m_buttonGroup->setButton(KACLListView::NamedUser);
        slotUpdateAllowedTypes();
        slotSelectionChanged(KACLListView::NamedUser);
        slotUpdateAllowedUsersAndGroups();
    }
    incInitialSize(QSize(100, 0));
}
Esempio n. 20
0
QWizardPage *AddFeedWizard::createUrlFeedPage()
{
  QWizardPage *page = new QWizardPage;
  page->setTitle(tr("Create New Feed"));

  selectedPage = false;
  finishOn = false;

  urlFeedEdit_ = new LineEdit(this);
  urlFeedEdit_->setText("http://");

  titleFeedAsName_ = new QCheckBox(
        tr("Use title of the feed as displayed name"), this);
  titleFeedAsName_->setChecked(true);

  authentication_ = new QGroupBox(this);
  authentication_->setTitle(tr("Server requires authentication:"));
  authentication_->setCheckable(true);
  authentication_->setChecked(false);

  user_ = new LineEdit(this);
  pass_ = new LineEdit(this);
  pass_->setEchoMode(QLineEdit::Password);

  QGridLayout *authenticationLayout = new QGridLayout();
  authenticationLayout->addWidget(new QLabel(tr("Username:"******"Password:"******":/images/warning"));
  textWarning = new QLabel(this);
  QFont font = textWarning->font();
  font.setBold(true);
  textWarning->setFont(font);

  QHBoxLayout *warningLayout = new QHBoxLayout();
  warningLayout->setMargin(0);
  warningLayout->addWidget(iconWarning);
  warningLayout->addWidget(textWarning, 1);

  warningWidget_ = new QWidget(this);
  warningWidget_->setLayout(warningLayout);

  progressBar_ = new QProgressBar(this);
  progressBar_->setObjectName("progressBar_");
  progressBar_->setTextVisible(false);
  progressBar_->setFixedHeight(15);
  progressBar_->setMinimum(0);
  progressBar_->setMaximum(0);
  progressBar_->setVisible(false);

  QVBoxLayout *layout = new QVBoxLayout;
  layout->addWidget(new QLabel(tr("Feed URL or website address:")));
  layout->addWidget(urlFeedEdit_);
  layout->addWidget(titleFeedAsName_);
  layout->addSpacing(10);
  layout->addWidget(authentication_);
  layout->addStretch(1);
  layout->addWidget(warningWidget_);
  layout->addWidget(progressBar_);
  page->setLayout(layout);

  connect(urlFeedEdit_, SIGNAL(textChanged(const QString&)),
          this, SLOT(urlFeedEditChanged(const QString&)));
  connect(titleFeedAsName_, SIGNAL(stateChanged(int)),
          this, SLOT(titleFeedAsNameStateChanged(int)));

  return page;
}
Esempio n. 21
0
ValidityDialog::ValidityDialog(QWidget* parent, Selection* selection)
        : KoPageDialog(parent)

{
    setFaceType(Tabbed);
    setCaption(i18n("Validity"));
    setModal(true);
    setButtons(Ok | Cancel | User1);
    setButtonGuiItem(User1, KGuiItem(i18n("Clear &All")));

    m_selection = selection;

    QFrame *page1 = new QFrame();
    addPage(page1, i18n("&Criteria"));

    QGridLayout* tmpGridLayout = new QGridLayout(page1);

    QLabel *tmpQLabel = new QLabel(page1);
    tmpQLabel->setText(i18n("Allow:"));
    tmpGridLayout->addWidget(tmpQLabel, 0, 0);

    chooseType = new KComboBox(page1);
    tmpGridLayout->addWidget(chooseType, 0, 1);
    chooseType->addItem(i18n("All"), QVariant::fromValue(Validity::None));
    chooseType->addItem(i18n("Number"), QVariant::fromValue(Validity::Number));
    chooseType->addItem(i18n("Integer"), QVariant::fromValue(Validity::Integer));
    chooseType->addItem(i18n("Text"), QVariant::fromValue(Validity::Text));
    chooseType->addItem(i18n("Date"), QVariant::fromValue(Validity::Date));
    chooseType->addItem(i18n("Time"), QVariant::fromValue(Validity::Time));
    chooseType->addItem(i18n("Text Length"), QVariant::fromValue(Validity::TextLength));
    chooseType->addItem(i18n("List"), QVariant::fromValue(Validity::List));
    chooseType->setCurrentIndex(0);

    allowEmptyCell = new QCheckBox(i18n("Allow blanks"), page1);
    tmpGridLayout->addWidget(allowEmptyCell, 1, 0, 1, 2);

    chooseLabel = new QLabel(page1);
    chooseLabel->setText(i18n("Data:"));
    tmpGridLayout->addWidget(chooseLabel, 2, 0);

    choose = new KComboBox(page1);
    tmpGridLayout->addWidget(choose, 2, 1);
    choose->addItem(i18n("equal to"), QVariant::fromValue(Conditional::Equal));
    choose->addItem(i18n("greater than"), QVariant::fromValue(Conditional::Superior));
    choose->addItem(i18n("less than"), QVariant::fromValue(Conditional::Inferior));
    choose->addItem(i18n("equal to or greater than"), QVariant::fromValue(Conditional::SuperiorEqual));
    choose->addItem(i18n("equal to or less than"), QVariant::fromValue(Conditional::InferiorEqual));
    choose->addItem(i18n("between"), QVariant::fromValue(Conditional::Between));
    choose->addItem(i18n("different from"), QVariant::fromValue(Conditional::Different));
    choose->addItem(i18n("different to"), QVariant::fromValue(Conditional::DifferentTo));
    choose->setCurrentIndex(0);

    edit1 = new QLabel(page1);
    edit1->setText(i18n("Minimum:"));
    tmpGridLayout->addWidget(edit1, 3, 0);

    val_min = new QLineEdit(page1);
    tmpGridLayout->addWidget(val_min, 3, 1);
    val_min->setValidator(new KDoubleValidator(val_min));

    edit2 = new QLabel(page1);
    edit2->setText(i18n("Maximum:"));
    tmpGridLayout->addWidget(edit2, 4, 0);

    val_max = new QLineEdit(page1);
    tmpGridLayout->addWidget(val_max, 4, 1);
    val_max->setValidator(new KDoubleValidator(val_max));

    //Apply minimum width of column1 to avoid horizontal move when changing option
    //A bit ugly to apply text always, but I couldn't get a label->QFontMetrix.boundingRect("text").width()
    //to give mew the correct results - Philipp
    edit2->setText(i18n("Date:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Date minimum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Date maximum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Time:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Time minimum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Time maximum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Minimum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Maximum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Number:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);

    validityList = new KTextEdit(page1);
    tmpGridLayout->addWidget(validityList, 2, 1, 3, 1);

    validityLabelList = new QLabel(page1);
    validityLabelList->setText(i18n("Entries:"));
    tmpGridLayout->addWidget(validityLabelList, 2, 0, Qt::AlignTop);

    tmpGridLayout->setRowStretch(5, 1);

    QFrame *page2 = new QFrame();
    addPage(page2, i18n("&Error Alert"));

    tmpGridLayout = new QGridLayout(page2);

    displayMessage = new QCheckBox(i18n("Show error message when invalid values are entered"), page2);
    displayMessage->setChecked(true);
    tmpGridLayout->addWidget(displayMessage, 0, 0, 1, 2);

    tmpQLabel = new QLabel(page2);
    tmpQLabel->setText(i18n("Action:"));
    tmpGridLayout->addWidget(tmpQLabel, 1, 0);

    chooseAction = new KComboBox(page2);
    tmpGridLayout->addWidget(chooseAction, 1, 1);
    chooseAction->addItem(i18n("Stop"), QVariant::fromValue(Validity::Stop));
    chooseAction->addItem(i18n("Warning"), QVariant::fromValue(Validity::Warning));
    chooseAction->addItem(i18n("Information"), QVariant::fromValue(Validity::Information));
    chooseAction->setCurrentIndex(0);

    tmpQLabel = new QLabel(page2);
    tmpQLabel->setText(i18nc("Title of message", "Title:"));
    tmpGridLayout->addWidget(tmpQLabel, 2, 0);

    title = new QLineEdit(page2);
    tmpGridLayout->addWidget(title, 2, 1);

    tmpQLabel = new QLabel(page2);
    tmpQLabel->setText(i18n("Message:"));
    tmpGridLayout->addWidget(tmpQLabel, 3, 0, Qt::AlignTop);

    message = new KTextEdit(page2);
    tmpGridLayout->addWidget(message, 3, 1);

    QFrame *page3 = new QFrame();
    addPage(page3, i18n("Input Help"));

    tmpGridLayout = new QGridLayout(page3);

    displayHelp = new QCheckBox(i18n("Show input help when cell is selected"), page3);
    displayMessage->setChecked(false);
    tmpGridLayout->addWidget(displayHelp, 0, 0, 1, 2);

    tmpQLabel = new QLabel(page3);
    tmpQLabel->setText(i18nc("Title of message", "Title:"));
    tmpGridLayout->addWidget(tmpQLabel, 1, 0);

    titleHelp = new QLineEdit(page3);
    tmpGridLayout->addWidget(titleHelp, 1, 1);

    tmpQLabel = new QLabel(page3);
    tmpQLabel->setText(i18n("Message:"));
    tmpGridLayout->addWidget(tmpQLabel, 2, 0, Qt::AlignTop);

    messageHelp = new KTextEdit(page3);
    tmpGridLayout->addWidget(messageHelp, 2, 1);

    connect(choose, SIGNAL(activated(int)), this, SLOT(changeIndexCond(int)));
    connect(chooseType, SIGNAL(activated(int)), this, SLOT(changeIndexType(int)));
    connect(this, SIGNAL(okClicked()), SLOT(OkPressed()));
    connect(this, SIGNAL(user1Clicked()), SLOT(clearAllPressed()));

    init();
}
Esempio n. 22
0
StartupView::StartupView( QWidget * parent ) 
  : QWidget( parent )
{
  m_templateListModel = std::shared_ptr<TemplateListModel>( new TemplateListModel() );

  setStyleSheet("openstudio--StartupView { background: #E6E6E6; }");
  
#ifdef Q_OS_MAC
  setWindowFlags(Qt::FramelessWindowHint);
#else
  setWindowFlags(Qt::CustomizeWindowHint);
#endif

  auto recentProjectsView = new QWidget();
  recentProjectsView->setStyleSheet("QWidget { background: #F2F2F2; }");
  auto recentProjectsLayout = new QVBoxLayout();
  recentProjectsLayout->setContentsMargins(10,10,10,10);
  QLabel * recentProjectsLabel = new QLabel("Recent Projects");
  recentProjectsLabel->setStyleSheet("QLabel { font: bold }");
  recentProjectsLayout->addWidget(recentProjectsLabel,0,Qt::AlignTop);
  recentProjectsView->setLayout(recentProjectsLayout);

  auto openButton = new QToolButton();
  openButton->setText("Open File");
  openButton->setStyleSheet("QToolButton { font: bold; }");
  openButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon openIcon(":/images/open_file.png");
  openButton->setIcon(openIcon);
  openButton->setIconSize(QSize(40,40));
  connect(openButton, &QToolButton::clicked, this, &StartupView::openClicked);
  auto importButton = new QToolButton();
  importButton->setText("Import Idf");
  importButton->setStyleSheet("QToolButton { font: bold; }");
  importButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importIcon(":/images/import_file.png");
  importButton->setIcon(importIcon);
  importButton->setIconSize(QSize(40,40));
  connect(importButton, &QToolButton::clicked, this, &StartupView::importClicked);
/*  
  QToolButton * importSDDButton = new QToolButton();
  importSDDButton->setText("Import SDD");
  importSDDButton->setStyleSheet("QToolButton { font: bold; }");
  importSDDButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importSDDIcon(":/images/import_file.png");
  importSDDButton->setIcon(importSDDIcon);
  importSDDButton->setIconSize(QSize(40,40));
  connect(importSDDButton, &QToolButton::clicked, this, &StartupView::importSDDClicked);
*/
  auto projectChooserView = new QWidget();
  projectChooserView->setFixedWidth(238);
  projectChooserView->setStyleSheet("QWidget { background: #F2F2F2; }");
  auto projectChooserLayout = new QVBoxLayout();
  projectChooserLayout->setContentsMargins(10,10,10,10);
  QLabel * projectChooserLabel = new QLabel("Create New From Template");
  projectChooserLabel->setStyleSheet("QLabel { font: bold }");
  projectChooserLayout->addWidget(projectChooserLabel,0,Qt::AlignTop);
  m_listView = new QListView();
  m_listView->setViewMode(QListView::IconMode);
  m_listView->setModel(m_templateListModel.get());
  m_listView->setFocusPolicy(Qt::NoFocus);
  m_listView->setFlow(QListView::LeftToRight);
  m_listView->setUniformItemSizes(true);
  m_listView->setSelectionMode(QAbstractItemView::SingleSelection);
  projectChooserLayout->addWidget(m_listView);
  projectChooserView->setLayout(projectChooserLayout);

  m_projectDetailView = new QWidget();
  m_projectDetailView->setStyleSheet("QWidget { background: #F2F2F2; }");
  auto projectDetailLayout = new QVBoxLayout();
  projectDetailLayout->setContentsMargins(10,10,10,10);
  m_projectDetailView->setLayout(projectDetailLayout);

  auto footerView = new QWidget();
  footerView->setObjectName("FooterView");
  footerView->setStyleSheet("QWidget#FooterView { background: #E6E6E6; }");
  footerView->setMaximumHeight(50);
  footerView->setMinimumHeight(50);

  auto cancelButton = new QPushButton();
  cancelButton->setObjectName("StandardGrayButton");
  cancelButton->setMinimumSize(QSize(99,28));
  #ifdef OPENSTUDIO_PLUGIN
    cancelButton->setText("Cancel");
    connect(cancelButton, &QPushButton::clicked, this, &StartupView::hide);
  #else
    #ifdef Q_OS_MAC
      cancelButton->setText("Quit");
    #else
      cancelButton->setText("Exit");
    #endif
    connect(cancelButton, &QPushButton::clicked, OpenStudioApp::instance(), &OpenStudioApp::quit);
  #endif
  cancelButton->setStyleSheet("QPushButton { font: bold; }");

  auto chooseButton = new QPushButton();
  chooseButton->setObjectName("StandardBlueButton");
  chooseButton->setText("Choose");
  chooseButton->setMinimumSize(QSize(99,28));
  connect(chooseButton, &QPushButton::clicked, this, &StartupView::newFromTemplateSlot);
  chooseButton->setStyleSheet("QPushButton { font: bold; }");

  auto hFooterLayout = new QHBoxLayout();
  hFooterLayout->setSpacing(25);
  hFooterLayout->setContentsMargins(0,0,0,0);
  hFooterLayout->addStretch();
  hFooterLayout->addWidget(cancelButton);
  hFooterLayout->addWidget(chooseButton);
  footerView->setLayout(hFooterLayout);

  auto hLayout = new QHBoxLayout();
  auto vLayout = new QVBoxLayout();

  auto vOpenLayout = new QVBoxLayout();
  vOpenLayout->addWidget(recentProjectsView);
  vOpenLayout->addWidget(openButton);
  vOpenLayout->addWidget(importButton);
  //vOpenLayout->addWidget(importSDDButton);

  hLayout->addLayout(vOpenLayout);
  hLayout->addWidget(projectChooserView);
  hLayout->addWidget(m_projectDetailView,1);

  vLayout->addSpacing(50);
  vLayout->addLayout(hLayout);
  vLayout->addWidget(footerView);

  setLayout(vLayout);

  connect(m_listView, &QListView::clicked, this, &StartupView::showDetailsForItem);

  m_listView->setCurrentIndex(m_templateListModel->index(0,0));
  showDetailsForItem(m_templateListModel->index(0,0));
}
Esempio n. 23
0
void FenPrincipale::calcul_general() {
	QString html = "<table>\n\t<thead>\n\t\t<tr>\n\t\t\t";
	html += "<td>"+tr("Position")+"</td>";
	html += "<td>"+tr("Équipage")+"</td>";
	html += "<td>"+tr("Points")+"</td>";
	for (int j = 0; j < this->nbManches; ++j) {
		html += "<td>"+tr("M")+QString::number(j+1)+"</td>";
	}
	html += "\n\t\t</tr>\n\t</thead>\n\t<tboby>";
	QTableWidget *table = new QTableWidget();
	table->verticalHeader()->hide();
	table->setSelectionMode(QAbstractItemView::NoSelection);
	table->setColumnCount(3+this->nbManches);
	table->setRowCount(this->nbEquipages);
	table->setColumnWidth(0, 80);
	table->setColumnWidth(1, 200);
	table->setColumnWidth(2, 60);
	int size = 80 + 200 + 60;
	QList<QString> labels;
	labels << tr("Position") << tr("Équipage") << tr("Points");
	for (int j = 0; j < this->nbManches; ++j) {
		labels << tr("M")+QString::number(j+1);
		size += 50;
		table->setColumnWidth(3+j, 50);
	}
	table->setMinimumWidth(size + 20);
	table->setMaximumWidth(size + 20);
	table->setHorizontalHeaderLabels(labels);
	ui->resultatsLayout->insertWidget(0, table);
	for (int i = 0; i < this->nbEquipages; ++i) {
		QList<int> ids;
		Equipage e1;
		for (int k = 0; k < this->nbEquipages; ++k) {
			Equipage e2 = this->equipages[k];
			if (e2.points <= 0) {
				// cet équipage a déjà été affiché
				continue;
			}
			if (ids.isEmpty() || e2.points < e1.points) {
				ids.clear();
				ids.append(k);
				e1 = e2;
			}
			else if (e2.points == e1.points) {
				// égalité de points
				// pour départager les équipages, on confronte leurs meilleures
				// manches (sans celles retirées)
				for (int j = 0; j < e1.pointsTries.size(); ++j) {
					if (e2.pointsTries[j] < e1.pointsTries[j]) {
						ids.clear();
						ids.append(k);
						e1 = e2;
						break;
					}
					else if (e2.pointsTries[j] > e1.pointsTries[j]) {
						break;
					}
					else if (j == e1.pointsTries.size()-1) {
						// égalité des manches
						// pour départager les équipages, on confronte toutes
						// leur manches dans l'ordre en partant de la dernière
						for (int l = 0; l < e1.pointsOrdonnes.size(); ++l) {
							if (e2.pointsOrdonnes[l] < e1.pointsOrdonnes[l]) {
								ids.clear();
								ids.append(k);
								e1 = e2;
								break;
							}
							else if (e2.pointsOrdonnes[l] > e1.pointsOrdonnes[l]) {
								break;
							}
							else if (l == e1.pointsOrdonnes.size()-1) {
								// égalité parfaite
								ids.append(k);
							}
						}
					}
				}
			}
		}
		for (int k = 0; k < ids.size(); ++k) {
			Equipage e = this->equipages[ids[k]];
			// on ajoute le début de la table html
			// on rajoute les manches en parallèle à causes de celles retirées
			QString nomString = "<span class=\"equipage\">"+e.nom+"</span>";
			if (this->typeClmt == CLMT_TEMPS) {
				nomString += "<span class=\"bateau\">"
					+this->bateaux.value(e.rating.toUpper()).serie
					+" ("+QString::number(e.coef)+")</span>";
			}
			html += "\n\t\t<tr>\n\t\t\t<td>"+QString::number(i+1)+"</td>"
				+"<td>"+nomString+"</td>"
				+"<td>"+QString::number(e.points)+"</td>";
			// on ajout l'équipage
			QLabel *pos = new QLabel(QString::number(i+1));
			QWidget *nomWidget = new QWidget();
			QVBoxLayout *nomLayout = new QVBoxLayout();
			QLabel *nom = new QLabel(e.nom);
			nom->setProperty("label", "nom");
			nomLayout->addWidget(nom);
			if (this->typeClmt == CLMT_TEMPS) {
				QLabel *bateau = new QLabel();
				bateau->setText(this->bateaux.value(e.rating.toUpper()).serie
					+" ("+QString::number(e.coef)+")");
				bateau->setProperty("label", "bateau");
				nomLayout->addWidget(bateau);
				table->setRowHeight(i+k, 45);
			}
			nomLayout->setContentsMargins(0, 0, 0, 0);
			nomLayout->setSpacing(0);
			nomWidget->setLayout(nomLayout);
			QLabel *points = new QLabel(QString::number(e.points));
			table->setCellWidget(i+k, 0, pos);
			table->setCellWidget(i+k, 1, nomWidget);
			table->setCellWidget(i+k, 2, points);
			for (int j = 0; j < this->nbManches; ++j) {
				Manche m = e.manches[j];
				QLabel *la = new QLabel();
				if (m.tpsCompense < 0) {
					la->setText(this->get_abr(m.abr));
				}
				else {
					la->setText(QString::number(m.points));
				}
				for (int l = 0; l < e.pointsRetires.size(); ++l) {
					if (e.pointsRetires[l] == m.points) {
						la->setText("("+la->text()+")");
						e.pointsRetires.removeAt(l);
						break;
					}
				}
				html += "<td>"+la->text()+"</td>";
				table->setCellWidget(i+k, j+3, la);
			}
			html += "\n\t\t</tr>";
			this->equipages[ids[k]].points = 0;
		}
		i += ids.size()-1;
	}
	html += "\n\t</tbody>\n</table>";
	this->htmls.prepend(html);
	this->progression(95);
}
Esempio n. 24
0
QLayout * PageEditTeam::bodyLayoutDefinition()
{
    QGridLayout * pageLayout = new QGridLayout();
    tbw = new QTabWidget();
    QWidget * page1 = new QWidget(this);
    binder = new KeyBinder(this, tr("Select an action to choose a custom key bind for this team"), tr("Use my default"), tr("Reset all binds"));
    connect(binder, SIGNAL(resetAllBinds()), this, SLOT(resetAllBinds()));
    tbw->addTab(page1, tr("General"));
    tbw->addTab(binder, tr("Custom Controls"));
    pageLayout->addWidget(tbw, 0, 0, 1, 3);

    QHBoxLayout * page1Layout = new QHBoxLayout(page1);
    page1Layout->setAlignment(Qt::AlignTop);

// ====== Page 1 ======
    QVBoxLayout * vbox1 = new QVBoxLayout();
    QVBoxLayout * vbox2 = new QVBoxLayout();
    page1Layout->addLayout(vbox1);
    page1Layout->addLayout(vbox2);

    GBoxHedgehogs = new QGroupBox(this);
    GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members"));
    GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs);


    GBHLayout->addWidget(new QLabel(tr("Hat")), 0, 0);
    GBHLayout->addWidget(new QLabel(tr("Name")), 0, 1);

    for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
    {
        HHHats[i] = new HatButton(GBoxHedgehogs);
        GBHLayout->addWidget(HHHats[i], i + 1, 0);

        HHNameEdit[i] = new QLineEdit(GBoxHedgehogs);
        HHNameEdit[i]->setMaxLength(64);
        HHNameEdit[i]->setMinimumWidth(120);
        HHNameEdit[i]->setFixedHeight(36);
        HHNameEdit[i]->setWhatsThis(tr("This hedgehog's name"));
        HHNameEdit[i]->setStyleSheet("padding: 6px;");
        GBHLayout->addWidget(HHNameEdit[i], i + 1, 1);

        btnRandomHogName[i] = addButton(":/res/dice.png", GBHLayout, i + 1, 3, 1, 1, true);
        btnRandomHogName[i]->setFixedHeight(HHNameEdit[i]->height());
        btnRandomHogName[i]->setWhatsThis(tr("Randomize this hedgehog's name"));
    }

    btnRandomTeam = new QPushButton();
    btnRandomTeam->setText(tr("Random Team"));
    btnRandomTeam->setStyleSheet("padding: 6px 10px;");
    GBHLayout->addWidget(btnRandomTeam, 9, 0, 1, 4, Qt::AlignCenter);
    btnRandomTeam->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    vbox1->addWidget(GBoxHedgehogs);

    GBoxTeam = new QGroupBox(this);
    GBoxTeam->setTitle(QGroupBox::tr("Team Settings"));
    GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    QGridLayout * GBTLayout = new QGridLayout(GBoxTeam);
    QLabel * tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Name"));
    GBTLayout->addWidget(tmpLabel, 0, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Type"));
    GBTLayout->addWidget(tmpLabel, 1, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Grave"));
    GBTLayout->addWidget(tmpLabel, 2, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Flag"));
    GBTLayout->addWidget(tmpLabel, 3, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Voice"));
    GBTLayout->addWidget(tmpLabel, 4, 0);

    TeamNameEdit = new QLineEdit(GBoxTeam);
    TeamNameEdit->setMaxLength(64);
    GBTLayout->addWidget(TeamNameEdit, 0, 1);
    vbox2->addWidget(GBoxTeam);

    CBTeamLvl = new QComboBox(GBoxTeam);
    CBTeamLvl->setIconSize(QSize(48, 48));
    CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human"));
    for(int i = 5; i > 0; i--)
        CBTeamLvl->addItem(
            QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)),
            QString("%1 %2").arg(QComboBox::tr("Level")).arg(i)
        );
    GBTLayout->addWidget(CBTeamLvl, 1, 1);

    CBGrave = new QComboBox(GBoxTeam);
    CBGrave->setMaxCount(65535);
    CBGrave->setIconSize(QSize(32, 32));
    GBTLayout->addWidget(CBGrave, 2, 1);

    CBFlag = new QComboBox(GBoxTeam);
    CBFlag->setMaxCount(65535);
    CBFlag->setIconSize(QSize(22, 15));
    GBTLayout->addWidget(CBFlag, 3, 1);

    QHBoxLayout * hbox = new QHBoxLayout();
    CBVoicepack = new QComboBox(GBoxTeam);

    hbox->addWidget(CBVoicepack, 100);
    btnTestSound = addSoundlessButton(":/res/PlaySound.png", hbox, 1, true);
    hbox->setStretchFactor(btnTestSound, 1);

    GBTLayout->addLayout(hbox, 4, 1);

    GBoxFort = new QGroupBox(this);
    GBoxFort->setTitle(QGroupBox::tr("Fort"));
    QGridLayout * GBFLayout = new QGridLayout(GBoxFort);
    CBFort = new QComboBox(GBoxFort);
    CBFort->setMaxCount(65535);
    GBFLayout->addWidget(CBFort, 0, 0);
    FortPreview = new SquareLabel(GBoxFort);
    FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    FortPreview->setMinimumSize(128, 128);
    FortPreview->setPixmap(QPixmap());
    // perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars
    //FortPreview->setAttribute(Qt::WA_PaintOnScreen, true);
    GBFLayout->addWidget(FortPreview, 1, 0);
    vbox2->addWidget(GBoxFort);

    vbox1->addStretch();
    vbox2->addStretch();

    return pageLayout;
}
Esempio n. 25
0
//! [0]
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), completer(0), lineEdit(0)
{
    createMenu();

    completer = new TreeModelCompleter(this);
    completer->setModel(modelFromFile(":/resources/treemodel.txt"));
    completer->setSeparator(QLatin1String("."));
    QObject::connect(completer, SIGNAL(highlighted(QModelIndex)),
                     this, SLOT(highlight(QModelIndex)));

    QWidget *centralWidget = new QWidget;

    QLabel *modelLabel = new QLabel;
    modelLabel->setText(tr("Tree Model<br>(Double click items to edit)"));

    QLabel *modeLabel = new QLabel;
    modeLabel->setText(tr("Completion Mode"));
    modeCombo = new QComboBox;
    modeCombo->addItem(tr("Inline"));
    modeCombo->addItem(tr("Filtered Popup"));
    modeCombo->addItem(tr("Unfiltered Popup"));
    modeCombo->setCurrentIndex(1);

    QLabel *caseLabel = new QLabel;
    caseLabel->setText(tr("Case Sensitivity"));
    caseCombo = new QComboBox;
    caseCombo->addItem(tr("Case Insensitive"));
    caseCombo->addItem(tr("Case Sensitive"));
    caseCombo->setCurrentIndex(0);
//! [0]

//! [1]
    QLabel *separatorLabel = new QLabel;
    separatorLabel->setText(tr("Tree Separator"));

    QLineEdit *separatorLineEdit = new QLineEdit;
    separatorLineEdit->setText(completer->separator());
    connect(separatorLineEdit, SIGNAL(textChanged(QString)),
            completer, SLOT(setSeparator(QString)));

    QCheckBox *wrapCheckBox = new QCheckBox;
    wrapCheckBox->setText(tr("Wrap around completions"));
    wrapCheckBox->setChecked(completer->wrapAround());
    connect(wrapCheckBox, SIGNAL(clicked(bool)), completer, SLOT(setWrapAround(bool)));

    contentsLabel = new QLabel;
    contentsLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(separatorLineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(updateContentsLabel(QString)));

    treeView = new QTreeView;
    treeView->setModel(completer->model());
    treeView->header()->hide();
    treeView->expandAll();
//! [1]

//! [2]
    connect(modeCombo, SIGNAL(activated(int)), this, SLOT(changeMode(int)));
    connect(caseCombo, SIGNAL(activated(int)), this, SLOT(changeCase(int)));

    lineEdit = new QLineEdit;
    lineEdit->setCompleter(completer);
//! [2]

//! [3]
    QGridLayout *layout = new QGridLayout;
    layout->addWidget(modelLabel, 0, 0); layout->addWidget(treeView, 0, 1);
    layout->addWidget(modeLabel, 1, 0);  layout->addWidget(modeCombo, 1, 1);
    layout->addWidget(caseLabel, 2, 0);  layout->addWidget(caseCombo, 2, 1);
    layout->addWidget(separatorLabel, 3, 0); layout->addWidget(separatorLineEdit, 3, 1);
    layout->addWidget(wrapCheckBox, 4, 0);
    layout->addWidget(contentsLabel, 5, 0, 1, 2);
    layout->addWidget(lineEdit, 6, 0, 1, 2);
    centralWidget->setLayout(layout);
    setCentralWidget(centralWidget);

    changeCase(caseCombo->currentIndex());
    changeMode(modeCombo->currentIndex());

    setWindowTitle(tr("Tree Model Completer"));
    lineEdit->setFocus();
}
WaterUseEquipmentDefinitionInspectorView::WaterUseEquipmentDefinitionInspectorView(bool isIP, const openstudio::model::Model& model, QWidget * parent)
    : ModelObjectInspectorView(model, true, parent)
{
    m_isIP = isIP;
    bool isConnected = false;

    QWidget* visibleWidget = new QWidget();
    this->stackedWidget()->addWidget(visibleWidget);

    QGridLayout* mainGridLayout = new QGridLayout();
    mainGridLayout->setContentsMargins(7,7,7,7);
    mainGridLayout->setSpacing(14);
    visibleWidget->setLayout(mainGridLayout);

    // Name

    QLabel* label = new QLabel("Name: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,0,0);

    m_nameEdit = new OSLineEdit();
    mainGridLayout->addWidget(m_nameEdit,1,0,1,3);

    // End Use Subcategory

    label = new QLabel("End Use Subcategory: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,2,0);

    m_endUseSubcategoryEdit = new OSLineEdit();
    mainGridLayout->addWidget(m_endUseSubcategoryEdit,3,0,1,3);

    // Peak Flow Rate

    label = new QLabel("Peak Flow Rate: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,4,0);

    m_peakFlowRateEdit = new OSQuantityEdit(m_isIP);
    isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_peakFlowRateEdit, SLOT(onUnitSystemChange(bool)));
    BOOST_ASSERT(isConnected);
    mainGridLayout->addWidget(m_peakFlowRateEdit,5,0,1,3);

    // Target Temperature Schedule

    label = new QLabel("Target Temperature Schedule: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,6,0);

    m_targetTemperatureScheduleVC = new TargetTemperatureScheduleVC();
    m_targetTemperatureScheduleDZ = new OSDropZone(m_targetTemperatureScheduleVC);
    m_targetTemperatureScheduleDZ->setMaxItems(1);
    mainGridLayout->addWidget(m_targetTemperatureScheduleDZ,7,0,1,3);

    // Sensible Fraction Schedule

    label = new QLabel("Sensible Fraction Schedule: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,8,0);

    m_sensibleFractionScheduleVC = new SensibleFractionScheduleVC();
    m_sensibleFractionScheduleDZ = new OSDropZone(m_sensibleFractionScheduleVC);
    m_sensibleFractionScheduleDZ->setMaxItems(1);
    mainGridLayout->addWidget(m_sensibleFractionScheduleDZ,9,0,1,3);

    // Latent Fraction Schedule

    label = new QLabel("Latent Fraction Schedule: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,10,0);

    m_latentFractionScheduleVC = new LatentFractionScheduleVC();
    m_latentFractionScheduleDZ = new OSDropZone(m_latentFractionScheduleVC);
    m_latentFractionScheduleDZ->setMaxItems(1);
    mainGridLayout->addWidget(m_latentFractionScheduleDZ,11,0,1,3);

    // Stretch

    mainGridLayout->setRowStretch(12,100);

    mainGridLayout->setColumnStretch(3,100);
}
Esempio n. 27
0
void addTab(std::string tabName, ImageStorage* imgstore, Ui::MainWindow *ui)
{
	/*ui->processBtn->setEnabled(true);
	ui->previousBtn->setEnabled(true);*/

	QWidget *tab = new QWidget();
	QString qname = QString::fromStdString(tabName);
	tab->setObjectName(qname);
	QHBoxLayout *horizontalLayout = new QHBoxLayout(tab);
	horizontalLayout->setSpacing(6);
	horizontalLayout->setContentsMargins(11, 11, 11, 11);
	horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
	QScrollArea * scrollArea = new QScrollArea(tab);
	scrollArea->setObjectName(QStringLiteral("scrollArea"));
	scrollArea->setWidgetResizable(true);
	QWidget * scrollAreaWidgetContents = new QWidget();
	scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents"));
	scrollAreaWidgetContents->setGeometry(QRect(0, 0, 492, 447));
	QHBoxLayout* horizontalLayout_13 = new QHBoxLayout(scrollAreaWidgetContents);
	horizontalLayout->setSpacing(6);
	horizontalLayout_13->setContentsMargins(11, 11, 11, 11);
	horizontalLayout_13->setObjectName(QStringLiteral("horizontalLayout_13"));
	QLabel* label = new QLabel(scrollAreaWidgetContents);
	std::string stmp = tabName;
	stmp.append("_label");
	QString qname2 = QString::fromStdString(stmp);
	label->setObjectName(qname2);
	QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Expanding);
	sizePolicy2.setHorizontalStretch(0);
	sizePolicy2.setVerticalStretch(0);
	sizePolicy2.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
	label->setSizePolicy(sizePolicy2);

	horizontalLayout_13->addWidget(label);
	scrollArea->setWidget(scrollAreaWidgetContents);
	horizontalLayout->addWidget(scrollArea);
	ui->imageTab->addTab(tab, QString());

	std::string tmp1 = tabName.c_str();
	const char* tmp2 = tmp1.c_str();
	ui->imageTab->setTabText(ui->imageTab->indexOf(tab), QApplication::translate("MainWindow", tmp2, 0));
	ui->imageTab->setCurrentIndex(ui->imageTab->indexOf(tab));


	//-------------------------

	//---------------------
	//display image

	cv::Mat image = std::get<1>(imgstore->getCurrent()->second);  
	QImage img;  
	if(image.channels() == 3)    // RGB image  
	{  
		//cvtColor(image, image, CV_BGR2RGB);  
		img = QImage((const uchar*)(image.data),  //(const unsigned char*)  
			image.cols, image.rows,  
			image.cols*image.channels(),
			QImage::Format_RGB888);  
	}else                     // gray image  
	{  
		img = QImage((const uchar*)(image.data),  
			image.cols, image.rows,  
			image.cols*image.channels(),
			QImage::Format_Indexed8);  
	}  

	if (!img.isNull())
	{
		label->setPixmap(QPixmap::fromImage(img));  
		label->resize(label->pixmap()->size());  
		label->setAlignment(Qt::AlignCenter);
		label->show();
	}
	else
	{
		ASSERT(0);
	}
	  

	//---------------------
}
Esempio n. 28
0
bool QVideoCapture::open_settingsDialog()
{
    if (m_cvCapture.isOpened() && deviceFlag)
    {
        //DIALOG CONSTRUCTION//
        QDialog dialog;
        dialog.setFixedSize(256,320);
        dialog.setWindowTitle(tr("Camcorder settings"));

        QVBoxLayout toplevellayout;
        toplevellayout.setMargin(5);
        QTabWidget tabwidget;

        QWidget page1; // a widget for a cam general settings selection
        QHBoxLayout centralbox;
        centralbox.setMargin(5);
        QVBoxLayout sliders;
        sliders.setMargin(5);
        QVBoxLayout lineedits;
        lineedits.setMargin(5);
        QVBoxLayout names;
        names.setMargin(5);

        QSlider Sbrightness;
        Sbrightness.setOrientation(Qt::Horizontal);
        Sbrightness.setMinimum(MIN_BRIGHTNESS);
        Sbrightness.setMaximum(MAX_BRIGHTNESS);
        Sbrightness.setValue( (int)m_cvCapture.get(CV_CAP_PROP_BRIGHTNESS) );
        QLabel Lbrightness;
        Lbrightness.setNum( (int)m_cvCapture.get(CV_CAP_PROP_BRIGHTNESS) );
        connect(&Sbrightness, SIGNAL(valueChanged(int)), &Lbrightness, SLOT(setNum(int)));
        connect(&Sbrightness, SIGNAL(valueChanged(int)), this, SLOT(set_brightness(int)));
        connect(this, SIGNAL(set_default_brightness(int)), &Sbrightness, SLOT(setValue(int)));
        QLabel Nbrightness("Brightness:");

        QSlider Scontrast;
        Scontrast.setOrientation(Qt::Horizontal);
        Scontrast.setMinimum(MIN_CONTRAST);
        Scontrast.setMaximum(MAX_CONTRAST);
        Scontrast.setValue( (int)m_cvCapture.get(CV_CAP_PROP_CONTRAST) );
        QLabel Lcontrast;
        Lcontrast.setNum( (int)m_cvCapture.get(CV_CAP_PROP_CONTRAST) );
        connect(&Scontrast, SIGNAL(valueChanged(int)), &Lcontrast, SLOT(setNum(int)));
        connect(&Scontrast,SIGNAL(valueChanged(int)), this, SLOT(set_contrast(int)));
        connect(this, SIGNAL(set_default_contrast(int)), &Scontrast, SLOT(setValue(int)));
        QLabel Ncontrast("Contrast:");

        QSlider Ssaturation;
        Ssaturation.setOrientation(Qt::Horizontal);
        Ssaturation.setMinimum(MIN_SATURATION);
        Ssaturation.setMaximum(MAX_SATURATION);
        Ssaturation.setValue( (int)m_cvCapture.get(CV_CAP_PROP_SATURATION) );
        QLabel Lsaturation;
        Lsaturation.setNum( (int)m_cvCapture.get(CV_CAP_PROP_SATURATION) );
        connect(&Ssaturation, SIGNAL(valueChanged(int)), &Lsaturation, SLOT(setNum(int)));
        connect(&Ssaturation,SIGNAL(valueChanged(int)), this, SLOT(set_saturation(int)));
        connect(this, SIGNAL(set_default_saturation(int)), &Ssaturation, SLOT(setValue(int)));
        QLabel Nsaturation("Saturation:");

        QSlider SwhitebalanceU;
        SwhitebalanceU.setOrientation(Qt::Horizontal);
        SwhitebalanceU.setMinimum(MIN_WHITE_BALANCE);
        SwhitebalanceU.setMaximum(MAX_WHITE_BALANCE);
        SwhitebalanceU.setValue( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_BLUE_U) );
        QLabel LwhitebalanceU;
        LwhitebalanceU.setNum( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_BLUE_U) );
        connect(&SwhitebalanceU, SIGNAL(valueChanged(int)), &LwhitebalanceU, SLOT(setNum(int)));
        connect(&SwhitebalanceU,SIGNAL(valueChanged(int)), this, SLOT(set_white_balanceU(int)));
        connect(this, SIGNAL(set_default_white_balanceU(int)), &SwhitebalanceU, SLOT(setValue(int)));
        QLabel NwhitebalanceU("White_balanceU:");

        QSlider SwhitebalanceV;
        SwhitebalanceV.setOrientation(Qt::Horizontal);
        SwhitebalanceV.setMinimum(MIN_WHITE_BALANCE);
        SwhitebalanceV.setMaximum(MAX_WHITE_BALANCE);
        SwhitebalanceV.setValue( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_RED_V) );
        QLabel LwhitebalanceV;
        LwhitebalanceV.setNum( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_RED_V) );
        connect(&SwhitebalanceV, SIGNAL(valueChanged(int)), &LwhitebalanceV, SLOT(setNum(int)));
        connect(&SwhitebalanceV,SIGNAL(valueChanged(int)), this, SLOT(set_white_balanceV(int)));
        connect(this, SIGNAL(set_default_white_balanceV(int)), &SwhitebalanceV, SLOT(setValue(int)));
        QLabel NwhitebalanceV("White_balanceV:");

        sliders.addWidget(&Sbrightness);
        lineedits.addWidget(&Lbrightness, 2);
        names.addWidget(&Nbrightness, 1);

        sliders.addWidget(&Scontrast);
        lineedits.addWidget(&Lcontrast, 2);
        names.addWidget(&Ncontrast, 1);

        sliders.addWidget(&Ssaturation);
        lineedits.addWidget(&Lsaturation, 2);
        names.addWidget(&Nsaturation, 1);

        sliders.addWidget(&SwhitebalanceU);
        lineedits.addWidget(&LwhitebalanceU, 2);
        names.addWidget(&NwhitebalanceU, 1);

        sliders.addWidget(&SwhitebalanceV);
        lineedits.addWidget(&LwhitebalanceV, 2);
        names.addWidget(&NwhitebalanceV, 1);

        centralbox.addLayout(&names);
        centralbox.addLayout(&sliders);
        centralbox.addLayout(&lineedits);
        page1.setLayout( &centralbox );

        QWidget page2; // a widget for a cam gain/exposure selection
        QHBoxLayout centralbox2;
        centralbox2.setMargin(5);
        QVBoxLayout sliders2;
        sliders2.setMargin(5);
        QVBoxLayout lineedits2;
        lineedits2.setMargin(5);
        QVBoxLayout names2;
        names2.setMargin(5);

        QSlider Sgain;
        Sgain.setOrientation(Qt::Horizontal);
        Sgain.setMinimum(MIN_GAIN);
        Sgain.setMaximum(MAX_GAIN);
        Sgain.setValue( (int)m_cvCapture.get(CV_CAP_PROP_GAIN) );
        QLabel Lgain;
        Lgain.setNum( (int)m_cvCapture.get(CV_CAP_PROP_GAIN) );
        connect(&Sgain, SIGNAL(valueChanged(int)), &Lgain, SLOT(setNum(int)));
        connect(&Sgain,SIGNAL(valueChanged(int)), this, SLOT(set_gain(int)));
        connect(this, SIGNAL(set_default_gain(int)), &Sgain, SLOT(setValue(int)),Qt::DirectConnection);
        QLabel Ngain("Gain:");

        QSlider Sexposure;
        Sexposure.setOrientation(Qt::Horizontal);
        Sexposure.setMinimum(MIN_EXPOSURE);
        Sexposure.setMaximum(MAX_EXPOSURE);
        Sexposure.setValue( (int)m_cvCapture.get(CV_CAP_PROP_EXPOSURE) );
        QLabel Lexposure;
        Lexposure.setNum( (int)m_cvCapture.get(CV_CAP_PROP_EXPOSURE) );
        connect(&Sexposure, SIGNAL(valueChanged(int)), &Lexposure, SLOT(setNum(int)));
        connect(&Sexposure,SIGNAL(valueChanged(int)), this, SLOT(set_exposure(int)));
        connect(this, SIGNAL(set_default_exposure(int)), &Sexposure, SLOT(setValue(int)));
        QLabel Nexposure("Exposure:");

        sliders2.addWidget(&Sgain);
        lineedits2.addWidget(&Lgain, 2);
        names2.addWidget(&Ngain, 1);

        sliders2.addWidget(&Sexposure);
        lineedits2.addWidget(&Lexposure, 2);
        names2.addWidget(&Nexposure, 1);

        centralbox2.addLayout(&names2);
        centralbox2.addLayout(&sliders2);
        centralbox2.addLayout(&lineedits2);
        page2.setLayout( &centralbox2 );


        QHBoxLayout buttons;
        buttons.setMargin(5);
        QPushButton Baccept;
        Baccept.setText(tr("Accept"));
        connect(&Baccept, SIGNAL(clicked()), &dialog, SLOT(accept()));
        QPushButton Bcancel;
        Bcancel.setText(tr("Cancel"));
        connect(&Bcancel, SIGNAL(clicked()), &dialog, SLOT(reject()));
        QPushButton Bdefault;
        Bdefault.setText(tr("Default"));
        connect(&Bdefault, SIGNAL(clicked()), this, SLOT(set_default_settings()));
        buttons.addWidget(&Baccept);
        buttons.addWidget(&Bcancel);
        buttons.addWidget(&Bdefault);

        tabwidget.addTab(&page1, "Brightness/Contrast");
        tabwidget.addTab(&page2, "Gain/Exposure");
        toplevellayout.addWidget(&tabwidget);
        toplevellayout.addLayout(&buttons);
        dialog.setLayout(&toplevellayout);
        //DIALOG CONSTRUCTION END//
        dialog.exec();
        return true;
    }
void NotificationDialog::getDataFromDatabase(){
    ui->tableWidget->setRowCount(0);
    bool disconnect = false;
    bool connected = true;
    if(!db.isOpen()){
        disconnect = true;
        connected = parent->connectToDatabase(&db, false, this);
    }
    if(connected){
        for(int i = 0; i < parent->cNotifications.size(); i++){
            QLabel * item = new QLabel;
            QStringList columnNames = parent->getColumnsNames("Customers");
            QVector<QStringList> retrievedData = parent->executeSelectCommand("Customers", columnNames, "ID=" + QString::number(parent->cNotifications[i].customer));
            if(!retrievedData.isEmpty()){
                if(!retrievedData[0].isEmpty()){
                    item->setText(retrievedData[columnNames.indexOf("Surname")][0] + " " + retrievedData[columnNames.indexOf("Name")][0] + " " + retrievedData[columnNames.indexOf("Patronomic")][0] + "\nТелефонный номер: (" + retrievedData[columnNames.indexOf("PhoneCode")][0] + ")" + retrievedData[columnNames.indexOf("PhoneNumber")][0] + "\nПО: " + parent->cNotifications[i].soft + "\nДата истечения лицензии: " + parent->cNotifications[i].date);
                    QFontMetrics fontMetrics = item->fontMetrics();
                    QSize textSize = fontMetrics.size(0, item->text());
                    int textWidth = textSize.width() + 30;
                    int textHeight = textSize.height() + 20;
                    item->setMinimumSize(textWidth, textHeight);
                    item->resize(textWidth, textHeight);
                    ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
                    ui->tableWidget->setCellWidget(ui->tableWidget->rowCount() - 1, 0, item);
                    ui->tableWidget->setRowHeight(ui->tableWidget->rowCount() - 1, textHeight);
                }
            }
        }
        for(int i = 0; i < parent->lNotifications.size(); i++){
            QLabel * item = new QLabel;
            item->setText("ПО: " + parent->lNotifications[i].soft + "\nОсталось лицензий: " + QString::number(parent->lNotifications[i].count));
            QFontMetrics fontMetrics = item->fontMetrics();
            QSize textSize = fontMetrics.size(0, item->text());
            int textWidth = textSize.width() + 30;
            int textHeight = textSize.height() + 20;
            item->setMinimumSize(textWidth, textHeight);
            item->resize(textWidth, textHeight);
            ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
            ui->tableWidget->setCellWidget(ui->tableWidget->rowCount() - 1, 0, item);
            ui->tableWidget->setRowHeight(ui->tableWidget->rowCount() - 1, textHeight);
        }
    }
    if(disconnect)
        parent->disconnectFromDatabase(&db);
}
void FilterSettingWidget::filterChanged(int _index)
{
	index = _index;

	// Clear filter settings
	foreach(QWidget *widget, settingWidgets)
		delete widget;
	settingWidgets.clear();

	foreach(PropertyAdaptor *adaptor, adaptors)
		delete adaptor;
	adaptors.clear();

	// Ensure size
	if ((int) chain->getChain().size() <= index)
		return;

	if (index >= 0) {
		// Add new filter name
		ImageFilterBase *filter = chain->getChain()[index];

		QString name = ((FilterButton*)list->itemWidget(list->item(index)))->getName();

		QLabel *label = new QLabel("Settings: "+name+") "+ QString::fromStdString(filter->name));
		label->setStyleSheet("QLabel{color:#8E5316;font-size:15px;font:bold;padding:3px;}");
		filterLayout->addWidget(label);
		settingWidgets.append(label);

		// Add new filter properties
		const FilterProperties& properties =  filter->getFilterProperties();

		if (properties.empty()){
			QLabel *label = new QLabel(tr("No settings available."));
			label->setStyleSheet("QLabel{color:#8E5316;font-size:15px;padding:3px;}");
			filterLayout->addWidget(label);
			settingWidgets.append(label);
		}

		for (FilterProperties::const_iterator it=properties.begin(); it!=properties.end(); ++it) {
			QLabel *label = new QLabel(QString::fromStdString(it->name));
			label->setStyleSheet("QLabel{color:#8E5316;font-size:15px;font:bold;}");

			filterLayout->addWidget(label);
			settingWidgets.append(label);

			PropertyAdaptor *adaptor = new PropertyAdaptor(filter, it->name);
			adaptors.append(adaptor);

			QString curValue(QString::fromStdString(filter->getProperty(it->name)));

			// Create the property widget
			QWidget *tmp = createPropertyWidget(*it, curValue, adaptor);

			tmp->setStyleSheet(stylesheet);

			tmp->setMinimumHeight(30);
			filterLayout->addWidget(tmp);
			settingWidgets.append(tmp);
		}
	}
}