void OpenInCompatibleSoftwareWidget::setContentsForResponse(const QVariantMap& response) { QTableWidget *tableWidget = ui->tableWidget; tableWidget->clearContents(); QTableWidgetItem *newItem = NULL; QVariantMap body = response["body"].toMap(); QVariantList softwares = body["gadgets"].toList(); for (int i = 0; i < softwares.count(); ++i) { QVariantMap software = softwares.at(i).toMap(); newItem = new QTableWidgetItem(software["name"].toString()); tableWidget->setItem(i, 0, newItem); newItem = new QTableWidgetItem(software["UUID"].toString()); tableWidget->setItem(i, 1, newItem); } }
void QTeam::aggiornaTabella( QTeamWidget* widget ) { int totGioc = mPorList.size()+mDifList.size()+mCenList.size()+mAttList.size(); int daComp = 25-totGioc; int maxSpesa = mBudget-daComp+1; int capitale = mBudget; if(daComp == 0) maxSpesa--; QTableWidget* tableWidget = widget->getTablePtr(); tableWidget->setUpdatesEnabled(false); tableWidget->clearContents(); int row = 0; foreach( const QPlayer* player, mPorList ) { QTableWidgetItem* item0 = new QTableWidgetItem(tr("%1").arg(player->mCodice) ); tableWidget->setItem( row, 0, item0 ); QTableWidgetItem* item1 = new QTableWidgetItem(tr("%1").arg(player->mNome) ); tableWidget->setItem( row, 1, item1 ); QTableWidgetItem* item2 = new QTableWidgetItem(tr("%1").arg(player->mSquadra) ); tableWidget->setItem( row, 2, item2 ); QTableWidgetItem* item3 = new QTableWidgetItem(tr("%1").arg(player->mValore) ); tableWidget->setItem( row, 3, item3 ); capitale += player->mValore; if(player->mNuovoAcq) { QTableWidgetItem* item4 = new QTableWidgetItem(tr("%1").arg(0) ); tableWidget->setItem( row, 4, item4 ); } else { QTableWidgetItem* item4 = new QTableWidgetItem(tr("%1").arg(player->mValAcq13_14) ); tableWidget->setItem( row, 4, item4 ); } QTableWidgetItem* item5 = new QTableWidgetItem(tr("%1").arg(player->mValAcquisto) ); tableWidget->setItem( row, 5, item5 ); QTableWidgetItem* item6 = new QTableWidgetItem(tr("%1").arg(player->mGiornAcq) ); tableWidget->setItem( row, 6, item6 ); QTableWidgetItem* item7 = new QTableWidgetItem(tr("%1").arg(player->mGiocate) ); tableWidget->setItem( row, 7, item7 ); QTableWidgetItem* item8 = new QTableWidgetItem(tr("%1").arg(player->mAmm) ); tableWidget->setItem( row, 8, item8 ); QTableWidgetItem* item9 = new QTableWidgetItem(tr("%1").arg(player->mEsp) ); tableWidget->setItem( row, 9, item9 ); QTableWidgetItem* item10 = new QTableWidgetItem(tr("%1").arg(player->mGolFatti) ); tableWidget->setItem( row, 10, item10 ); QTableWidgetItem* item11 = new QTableWidgetItem(tr("%1").arg(player->mGolSubiti) ); tableWidget->setItem( row, 11, item11 ); QTableWidgetItem* item12 = new QTableWidgetItem(tr("%1").arg(player->mAssTot) ); tableWidget->setItem( row, 12, item12 ); QTableWidgetItem* item13 = new QTableWidgetItem(tr("%1").arg(player->mRigPar) ); tableWidget->setItem( row, 13, item13 ); QTableWidgetItem* item14 = new QTableWidgetItem(tr("%1").arg(player->mRigSbag) ); tableWidget->setItem( row, 14, item14 ); QTableWidgetItem* item15 = new QTableWidgetItem(tr("%1").arg(player->mRigSegn) ); tableWidget->setItem( row, 15, item15 ); QTableWidgetItem* item16 = new QTableWidgetItem(tr("%1").arg(player->mAutogol) ); tableWidget->setItem( row, 16, item16 ); QTableWidgetItem* item17 = new QTableWidgetItem(tr("%1").arg(player->mGolWin) ); tableWidget->setItem( row, 17, item17 ); QTableWidgetItem* item18 = new QTableWidgetItem(tr("%1").arg(player->mMedia) ); tableWidget->setItem( row, 18, item18 ); QTableWidgetItem* item19 = new QTableWidgetItem(tr("%1").arg(player->mMediaFC) ); tableWidget->setItem( row, 19, item19 ); row++; }
void QuickStartWizard::loadShare() { std::cerr << "ShareManager:: In load !!!!!" << std::endl ; std::list<SharedDirInfo>::const_iterator it; std::list<SharedDirInfo> dirs; rsFiles->getSharedDirectories(dirs); ui.shareIncomingDirectory->setChecked(rsFiles->getShareDownloadDirectory()); /* get a link to the table */ QTableWidget *listWidget = ui.shareddirList; /* remove old items ??? */ listWidget->clearContents() ; listWidget->setRowCount(0) ; connect(this,SIGNAL(itemClicked(QTableWidgetItem*)),this,SLOT(updateFlags(QTableWidgetItem*))) ; int row=0 ; for(it = dirs.begin(); it != dirs.end(); ++it,++row) { listWidget->insertRow(row) ; listWidget->setItem(row,0,new QTableWidgetItem(QString::fromStdString((*it).filename))); #ifdef USE_COMBOBOX QComboBox *cb = new QComboBox ; cb->addItem(tr("Network Wide")) ; cb->addItem(tr("Browsable")) ; cb->addItem(tr("Universal")) ; cb->setToolTip(tr("Please decide whether this directory is\n* Network Wide: \tanonymously shared over the network (including your friends)\n* Browsable: \tbrowsable by your friends\n* Universal: \t\tboth")) ; // TODO // - set combobox current value depending on what rsFiles reports. // - use a signal mapper to get the correct row that contains the combo box sending the signal: // mapper = new SignalMapper(this) ; // // for(all cb) // { // signalMapper->setMapping(cb,...) // } // int index = 0 ; index += ((*it).shareflags & RS_FILE_HINTS_NETWORK_WIDE) > 0 ; index += (((*it).shareflags & RS_FILE_HINTS_BROWSABLE) > 0) * 2 ; listWidget->setCellWidget(row,1,cb); if(index < 1 || index > 3) std::cerr << "******* ERROR IN FILE SHARING FLAGS. Flags = " << (*it).shareflags << " ***********" << std::endl ; else index-- ; cb->setCurrentIndex(index) ; #else QCheckBox *cb1 = new QCheckBox ; QCheckBox *cb2 = new QCheckBox ; cb1->setChecked( (*it).shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS ) ; cb2->setChecked( (*it).shareflags & DIR_FLAGS_BROWSABLE_OTHERS ) ; cb1->setToolTip(tr("If checked, the share is anonymously shared to anybody.")) ; cb2->setToolTip(tr("If checked, the share is browsable by your friends.")) ; listWidget->setCellWidget(row,1,cb1); listWidget->setCellWidget(row,2,cb2); QObject::connect(cb1,SIGNAL(toggled(bool)),this,SLOT(updateFlags(bool))) ; QObject::connect(cb2,SIGNAL(toggled(bool)),this,SLOT(updateFlags(bool))) ; #endif } //ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory())); listWidget->update(); /* update display */ update(); }
/*************************************************************************** Updates list of servers in network page in proper QTableViews ***************************************************************************/ void fc_client::update_server_list(enum server_scan_type sstype, const struct server_list *list) { QTableWidget* sel = NULL; QString host, portstr; int port; switch (sstype) { case SERVER_SCAN_LOCAL: sel = lan_widget; break; case SERVER_SCAN_GLOBAL: sel = wan_widget; break; default: break; } if (!sel) { return; } if (!list) { return; } host = connect_host_edit->text(); portstr = connect_port_edit->text(); port = portstr.toInt(); sel->clearContents(); sel->setRowCount(0); int row = 0; server_list_iterate(list, pserver) { char buf[20]; sel->insertRow(row); if (pserver->humans >= 0) { fc_snprintf(buf, sizeof(buf), "%d", pserver->humans); } else { strncpy(buf, _("Unknown"), sizeof(buf)); } int tmp = pserver->port; QString tstring = QString::number(tmp); for (int col = 0; col < 6; col++) { QTableWidgetItem *item; item = new QTableWidgetItem(); switch (col) { case 0: item->setText(pserver->host); break; case 1: item->setText(tstring); break; case 2: item->setText(pserver->version); break; case 3: item->setText(_(pserver->state)); break; case 4: item->setText(buf); break; case 5: item->setText(pserver->message); break; default: break; } sel->setItem(row, col, item); } if (host == pserver->host && port == pserver->port) { sel->selectRow(row); } row++; } server_list_iterate_end;