///////////////////////////////////////// // open catalogue void CComDlg::on_pushButton_3_clicked() ///////////////////////////////////////// { if (tComets.count() != 0) { if (msgBoxQuest(this, cSaveQuest) == QMessageBox::Yes) { comSave(curCometCatName, this); } } deleteTracking(MO_COMET); releaseHoldObject(MO_COMET); pcMainWnd->removeQuickInfo(MO_COMET); g_comAstChanged = true; comClear(); QString name = QFileDialog::getOpenFileName(this, tr("Open a File"), QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/data/catalogue/comets", "Comets file (*.cdf)"); if (name.isEmpty()) { fillList(); updateDlg(); return; } comLoad(name); fillList(); updateDlg(); }
void CSatelliteDlg::on_pushButton_6_clicked() { if (sgp4.count() != 0) { if (msgBoxQuest(this, m_cSaveQuest) == QMessageBox::Yes) { if (!save(curSatelliteCatName)) { return; } } } deleteTracking(MO_SATELLITE); releaseHoldObject(MO_SATELLITE); pcMainWnd->removeQuickInfo(MO_SATELLITE); curSatelliteCatName.clear(); sgp4.removeAll(); fillList(); CDownloadFile dlg(this, QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/data/urls/art_sat.url"); if (dlg.exec() == DL_OK) { if (dlg.m_filePath.isEmpty()) { return; } sgp4.loadTLEData(dlg.m_filePath); curSatelliteCatName = dlg.m_filePath; fillList(); } }
int main() { int size1, size2; cout << "Enter the size of list1: "; cin >> size1; List *head1; head1 = createList(); fillList(head1, size1); print(head1); sort(head1, size1); print(head1); cout << "\nEnter the size of list2: "; cin >> size2; List *head2; head2 = createList(); fillList(head2, size2); print(head2); sort(head2, size2); print(head2); List* tmp; for(tmp = head1; tmp->next; tmp = tmp->next); tmp->next = head2; cout << "\nUnited list" << endl; print(head1); sort(head1, size1+size2); print(head1); system("pause"); outInFile(head1); return 0; }
void DisplayBothGeneralities::reinit() { _listLeft->clear(); _listRight->clear(); fillList( _listLeft, _lordLeft ); fillList( _listRight, _lordRight ); }
int main(int argc, const char * argv[]) { int a[10] = {1,3,9,8,4,2,5,0,7.6}; int b[4] = {2,2,3}; int c[4] = {1,3,3,4}; SeqList list;//这个怎么直接全部赋值 fillList(&list, a, 10); printf("获取位置:%d\n",Locate(list, 2));//按内容查找 printf("插入:%s\n",InsList(&list,2,10)==1?"OK":"ERROR");//插入 int delement; printf("删除:%s,删除的元素:%d\n",DelList(&list,3,&delement)==1?"ok":"ERROR",delement);//删除 SeqList list1,list2,list3; fillList(&list1,b,3); fillList(&list2,c,4); mergeList(&list1,&list2,&list3);//合并两个非递减有序线性表 printf("合并后的list:%d\n",list3.elem[7]); printf("---------%s---------\n","链表"); //----------链表------- LinkList L; InitList(&L); //CreateFromHead(L); CreateFormTail(&L); Node *p = Get(L, 2); printf("链表的第2个节点:%c\n",p->data); Node *pp = Located(L,'2'); printf("key是2的节点:%c\n",pp->data); printf("链表的长度是:%d\n",ListLength(L)); InseList(L,1,'5'); printf("插入后的链表长度:%d,首节点:%c\n",ListLength(L),Get(L, 1)->data); char tem; DellList(L,1,&tem); printf("链表长度%d,删除链表元素:%c\n",ListLength(L),tem); LinkList Lb = L; printf("合并后的长度%d\n",ListLength(MergeLinkList(L,Lb))); return 0; }
void UploadImpl::importButton() { QString file; file = QFileDialog::getOpenFileName(this, tr("Import Exercise Data"), "", tr("Comma separated files (*.csv *.txt);;Garmin FIT file (*.fit)")); if (!file.isEmpty()) { if ( QFileInfo(file.toLower()).suffix() == "fit") { // Garmin FIT file QFile fitFile(file); if (!fitFile.open(QIODevice::ReadOnly)) return; QByteArray blob = fitFile.readAll(); std::vector<uint8_t> fitData(blob.begin(), blob.end()); FIT fit; fit.parse (fitData, exdata); } else { // csv file ReadCSV(qPrintable(file), exdata); } if (exdata.size()) { fillList(); } } }
void MainWindow::onScan() { if (scan->exec() == QDialog::Accepted) { fillList(scan); } scan->writeSettings(); }
void MainWindow::onRSS() { if (rss->exec() == QDialog::Accepted) { fillList(rss); } rss->writeSettings(); }
bool ProfilesDialog::slotSaveProfile() { if (!m_customProfilePath.isEmpty()) { saveProfile(m_customProfilePath); return true; } const QString profileDesc = m_view.description->text(); int ix = m_view.profiles_list->findText(profileDesc); if (ix != -1) { // this profile name already exists const QString path = m_view.profiles_list->itemData(ix).toString(); if (!path.contains('/')) { KMessageBox::sorry(this, i18n("A profile with same name already exists in MLT's default profiles, please choose another description for your custom profile.")); return false; } saveProfile(path); } else { int i = 0; QString customName = "profiles/customprofile"; QString profilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + customName + QString::number(i); //qDebug() << " TYING PROFILE FILE: " << profilePath; while (QFile::exists(profilePath)) { ++i; profilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + customName + QString::number(i); } saveProfile(profilePath); } m_profileIsModified = false; fillList(profileDesc); m_view.button_create->setEnabled(true); return true; }
CComDlg::CComDlg(QWidget *parent) : QDialog(parent), ui(new Ui::CComDlg) { cSaveQuest = tr("Save current catalogue to disc?"); ui->setupUi(this); setWindowFlags(((windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowCloseButtonHint)); QStandardItemModel *model = new QStandardItemModel(0, 1, NULL); model->setHeaderData(0, Qt::Horizontal, QObject::tr("Name")); ui->listView->setModel(model); ui->listView->activateWindow(); fillList(); updateDlg(); QShortcut *sh1 = new QShortcut(QKeySequence(Qt::Key_Delete), ui->listView, 0, 0, Qt::WidgetShortcut); connect(sh1, SIGNAL(activated()), this, SLOT(slotDelete())); ui->widget->setModel((QSortFilterProxyModel *)ui->listView->model(), 0); connect(ui->widget, SIGNAL(sigSetSelection(QModelIndex&)), this, SLOT(slotSelChange(QModelIndex&))); }
void MonteCarlo::monteCarloAlgorithm() { logg("start monteCarlo algorithm..."); Time st(boost::posix_time::microsec_clock::local_time()); calculateEnergy(); vector<cell*> listCells; for (int i = 0; i < 100; i++) { copySpaces(oldstate, cells); fillList(&listCells, cells); //cout<<listCells.size()<<endl; if(listCells.size()>0){ executeList(&listCells,cells,oldstate); } manager->run(); manager->join_all(); listCells.clear(); } Time end(boost::posix_time::microsec_clock::local_time()); TimeDuraction d = end - st; duraction = d.total_milliseconds(); loggTime("time execution montecarlo algorithm: ",duraction); saveToFile(); //drawSpace(); }
bool ProfilesDialog::slotSaveProfile() { const QString profileDesc = m_view.description->text(); int ix = m_view.profiles_list->findText(profileDesc); if (ix != -1) { // this profile name already exists const QString path = m_view.profiles_list->itemData(ix).toString(); if (!path.contains('/')) { KMessageBox::sorry(this, i18n("A profile with same name already exists in MLT's default profiles, please choose another description for your custom profile.")); return false; } saveProfile(path); } else { int i = 0; QString customName = "profiles/customprofile"; QString profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i)); kDebug() << " TYING PROFILE FILE: " << profilePath; while (KIO::NetAccess::exists(KUrl(profilePath), KIO::NetAccess::SourceSide, this)) { i++; profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i)); } saveProfile(profilePath); } m_profileIsModified = false; fillList(profileDesc); m_view.button_create->setEnabled(true); return true; }
LRESULT FavoriteHubsFrame::onEdit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { int i = -1; if((i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry* e = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); bool isActive = ClientManager::getInstance()->isActive(); dcassert(e != NULL); TabbedDialog dlg(STRING(FAVORITE_HUB_PROPERTIES)); dlg.addPage<FavHubGeneralPage>(shared_ptr<FavHubGeneralPage>(new FavHubGeneralPage(e, STRING(SETTINGS_GENERAL)))); dlg.addPage<FavHubOptionsPage>(shared_ptr<FavHubOptionsPage>(new FavHubOptionsPage(e, STRING(SETTINGS_OPTIONS)))); if(dlg.DoModal(m_hWnd) == IDOK) { if (ClientManager::getInstance()->isActive() != isActive) { ConnectivityManager::getInstance()->setup(true, true); } FavoriteManager::getInstance()->onFavoriteHubUpdated(e); StateKeeper keeper(ctrlHubs); fillList(); } } return 0; }
LRESULT SearchTypeDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { ATTACH(IDC_TYPE_NAME, ctrlTypeName); ctrlTypeName.SetWindowText(Text::toT(name).c_str()); ctrlTypeName.EnableWindow(!isDefault); ATTACH(IDC_EXTENSION_NAME, ctrlExtensionName); ATTACH(IDC_EXTENSIONS, ctrlExtensions); CRect rc; ctrlExtensions.GetClientRect(rc); ctrlExtensions.SetExtendedListViewStyle(LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT); ctrlExtensions.InsertColumn(0, _T("Dummy"), LVCFMT_LEFT, (rc.Width() - 17), 0); //ctrlExtensions.SetExtendedListViewStyle(LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); ::SetWindowText(GetDlgItem(IDCANCEL), CTSTRING(CANCEL)); ::SetWindowText(GetDlgItem(IDC_NAME_LABEL), CTSTRING(NAME)); ::SetWindowText(GetDlgItem(IDC_REMOVE), CTSTRING(REMOVE)); ::SetWindowText(GetDlgItem(IDC_ADD), CTSTRING(ADD)); ::SetWindowText(GetDlgItem(IDC_EXTENSIONS_LABEL), CTSTRING(SETTINGS_EXTENSIONS)); ::EnableWindow(GetDlgItem(IDC_REMOVE), false); fillList(); CenterWindow(GetParent()); SetWindowText(CTSTRING(ADLS_TYPE)); return TRUE; }
void ThreadList::updateThreads(const ProcessInfo* processInfo, SymbolInfo *symInfo) { this->selected_threads.clear(); DeleteAllItems(); this->threads.clear(); ok_button->Enable(false); all_button->Enable(false); if(processInfo != NULL) { this->process_handle = processInfo->getProcessHandle(); this->syminfo = symInfo; this->threads = processInfo->threads; int numDisplayedThreads = getNumDisplayedThreads(); for(int i=0; i<numDisplayedThreads; ++i) { long tmp = this->InsertItem(i, "", -1); SetItemData(tmp, i); } all_button->Enable(this->threads.size() != 0); lastTime = wxGetLocalTimeMillis(); updateTimes(); updateSorting(); fillList(); } }
LRESULT SearchTypeDlg::onAdd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { TCHAR buf[512]; if (ctrlExtensionName.GetWindowTextLength() == 0) { MessageBox(CTSTRING(LINE_EMPTY)); return 0; } ctrlExtensionName.GetWindowText(buf, 512); StringTokenizer<tstring> t(buf, ';'); for (auto i = t.getTokens().begin(); i != t.getTokens().end(); ++i) { if(!i->empty()) { if(Util::checkExtension(Text::fromT(*i))) { extList.push_back(Text::fromT(buf)); } else { MessageBox(CTSTRING_F(INVALID_EXTENSION, *i)); } } } fillList(); ctrlExtensionName.SetWindowText(_T("")); return 0; }
ConnectDialog::ConnectDialog(QWidget *p) : QDialog(p) { qhList = new QHttp(QLatin1String("mumble.hive.no"), 80, this); qhList->setObjectName(QLatin1String("Request")); setupUi(this); #ifdef Q_OS_MAC setWindowFlags(Qt::Sheet); #endif bPublicInit = false; bDirty = false; if (tPublicServers.elapsed() >= 60 * 24 * 1000000ULL) { qlPublicServers.clear(); } qtwServers->sortItems(0, Qt::AscendingOrder); qstmServers = new QSqlTableModel(this); qstmServers->setTable(QLatin1String("servers")); qstmServers->setSort(1, Qt::AscendingOrder); if (! qstmServers->select()) { qWarning("ConnectDialog: Failed to reselect table"); } qstmServers->setEditStrategy(QSqlTableModel::OnManualSubmit); qlwServers->setModel(qstmServers); qlwServers->setModelColumn(1); QItemSelectionModel *selectionModel = qlwServers->selectionModel(); connect(selectionModel, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(onSelection_Changed(const QModelIndex &, const QModelIndex &))); connect(qleName, SIGNAL(textEdited(const QString &)), this, SLOT(onDirty(const QString &))); connect(qleServer, SIGNAL(textEdited(const QString &)), this, SLOT(onDirty(const QString &))); connect(qleUsername, SIGNAL(textEdited(const QString &)), this, SLOT(onDirty(const QString &))); connect(qlePassword, SIGNAL(textEdited(const QString &)), this, SLOT(onDirty(const QString &))); connect(qlePort, SIGNAL(textEdited(const QString &)), this, SLOT(onDirty(const QString &))); qlePort->setValidator(new QIntValidator(1, 65535, qlePort)); if (g.sh && g.sh->isRunning()) { fillEmpty(); } else { QModelIndex idx = qstmServers->index(g.s.iServerRow, 0); if (idx.isValid()) { qlwServers->setCurrentIndex(idx); } else if (qstmServers->rowCount() > 0) { qlwServers->setCurrentIndex(qstmServers->index(0,0)); } } fillList(); qtwTab->setCurrentIndex(0); if (qstmServers->rowCount() < 1) { on_qpbAdd_clicked(); qtwTab->setCurrentIndex(1); } }
void CSatelliteDlg::on_pushButton_5_clicked() { QStandardItemModel *model = (QStandardItemModel *)ui->listView->model(); for (int i = 0; i < model->rowCount(); i++) { QStandardItem *item = model->item(i); sgp4.tleItem(i)->used = item->checkState() == Qt::Checked ? true : false; } if (sgp4.count() != 0) { if (msgBoxQuest(this, m_cSaveQuest) == QMessageBox::Yes) { if (!save(curSatelliteCatName)) { return; } } } deleteTracking(MO_SATELLITE); releaseHoldObject(MO_SATELLITE); pcMainWnd->removeQuickInfo(MO_SATELLITE); curSatelliteCatName.clear(); sgp4.removeAll(); fillList(); }
void ProfilesDialog::slotDeleteProfile() { const QString path = m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString(); if (path.contains('/')) { KIO::NetAccess::del(KUrl(path), this); fillList(); } else kDebug() << "//// Cannot delete profile " << path << ", does not seem to be custom one"; }
void ChannelEditor::setHideMode(bool hide) { if (m_currentHideMode != hide) { m_currentHideMode = hide; fillList(); } }
void display::showEvent(QShowEvent * e) { XWidget::showEvent(e); if (_data->_queryOnStartEnabled && _data->_queryonstart->isChecked()) emit fillList(); }
LRESULT FavoriteHubsFrame::onManageGroups(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { FavHubGroupsDlg dlg; dlg.DoModal(); StateKeeper keeper(ctrlHubs); fillList(); return 0; }
void UploadImpl::syncButton() { SyncImpl win(this); win.exec(); win.getData(exdata); fillList(); }
void ChannelEditor::transportEditor(void) { TransportListEditor *editor = new TransportListEditor(m_sourceFilter); editor->exec(); editor->deleteLater(); fillList(); }
void FaceDetectorFilter::facesCallback(const pcl::PointCloud<pcl::PointXYZL>::ConstPtr& msg) { tf::Transform cameraTransform; try { tf::StampedTransform tr; transformListener.lookupTransform ( "odom","camera_link2",ros::Time(0),tr); cameraTransform=tr; } catch(...) { return; } std::set<unsigned int> usedUsers = deleteOld(); std::list<Point> incomingUsers; fillList(incomingUsers, msg,cameraTransform); while(1) { std::pair<unsigned int,std::list<Point>::iterator> match = findClosest(incomingUsers); if(match.first == 0) break; float distance = getDistance(users[match.first],*match.second); if(distance> MAX_SPEED) break; if(usedUsers.find(match.first) == usedUsers.end()) { users[match.first] = *match.second; usedUsers.insert(match.first); std::cerr<<"user updated: "<<match.first<<", distance:" <<distance<<std::endl; } else { std::cerr<<"user ignored: "<<match.first<<", distance:" <<distance<<std::endl; } incomingUsers.erase(match.second); } for(std::list<Point>::iterator it = incomingUsers.begin(); it!=incomingUsers.end(); ++it) { unsigned int newId = getAvailableId(usedUsers); users[newId] = *it; std::cerr<<"added user: "******"camera_link2"; pmsg->height = 1; for(std::map<unsigned int,Point>::iterator it = users.begin(); it != users.end(); ++it) { pcl::PointXYZL point; Point p(it->second); transformPoint(p,cameraTransform,true); point.label = it->first; point.x=p.x; point.y=p.y; point.z = p.z; pmsg->points.push_back(point); } pmsg->width = pmsg->points.size(); facePublisher.publish(pmsg); }
void ThreadList::updateSorting() { switch(sort_column) { case COL_ID: sortByID(); break; case COL_LOCATION: sortByLocation(); break; case COL_CPUUSAGE: sortByCpuUsage(); break; } fillList(); }
display::display(QWidget* parent, const char* name, Qt::WindowFlags flags) : XWidget(parent, name, flags) { _data = new displayPrivate(this); QPushButton* filterButton = findChild<QPushButton*>("_filterButton"); // Set text _data->_newBtn->setText(tr("New")); _data->_closeBtn->setText(tr("Close")); _data->_moreBtn->setText(tr("More")); _data->_printBtn->setText(tr("Print")); _data->_previewBtn->setText(tr("Preview")); _data->_queryBtn->setText(tr("Query")); _data->_queryOnStartAct->setText(tr("Query on start")); _data->_autoUpdateAct->setText(tr("Automatically Update")); // Set shortcuts _data->_newAct->setShortcut(QKeySequence::New); _data->_closeAct->setShortcut(QKeySequence::Close); _data->_queryAct->setShortcut(QKeySequence::Refresh); _data->_printAct->setShortcut(QKeySequence::Print); _data->_search->setNullStr(tr("search")); _data->_searchAct->setShortcut(QKeySequence::InsertParagraphSeparator); _data->_searchAct->setShortcutContext(Qt::WidgetWithChildrenShortcut); // Set tooltips _data->_newBtn->setToolTip(_data->_newBtn->text() + " " + _data->_newAct->shortcut().toString(QKeySequence::NativeText)); _data->_closeBtn->setToolTip(_data->_closeBtn->text() + " " + _data->_closeAct->shortcut().toString(QKeySequence::NativeText)); _data->_queryBtn->setToolTip(_data->_queryBtn->text() + " " + _data->_queryAct->shortcut().toString(QKeySequence::NativeText)); _data->_printBtn->setToolTip(_data->_printBtn->text() + " " + _data->_printAct->shortcut().toString(QKeySequence::NativeText)); connect(_data->_newBtn, SIGNAL(clicked()), _data->_newAct, SLOT(trigger())); connect(_data->_closeBtn, SIGNAL(clicked()), _data->_closeAct, SLOT(trigger())); connect(_data->_moreBtn, SIGNAL(clicked(bool)), filterButton, SLOT(setChecked(bool))); connect(_data->_printBtn, SIGNAL(clicked()), _data->_printAct, SLOT(trigger())); connect(_data->_previewBtn, SIGNAL(clicked()), _data->_previewAct, SLOT(trigger())); connect(_data->_queryBtn, SIGNAL(clicked()), _data->_queryAct, SLOT(trigger())); // Connect these two simply so checkbox takes care of pref. memory. Could separate out later. connect(_data->_autoupdate, SIGNAL(toggled(bool)), _data->_autoUpdateAct, SLOT(setChecked(bool))); connect(_data->_autoUpdateAct, SIGNAL(triggered(bool)), _data->_autoupdate, SLOT(setChecked(bool))); connect(_data->_queryonstart, SIGNAL(toggled(bool)), _data->_queryOnStartAct, SLOT(setChecked(bool))); connect(_data->_queryOnStartAct, SIGNAL(triggered(bool)), _data->_queryonstart, SLOT(setChecked(bool))); // Connect Actions connect(_data->_newAct, SIGNAL(triggered()), this, SLOT(sNew())); connect(_data->_closeAct, SIGNAL(triggered()), this, SLOT(close())); connect(_data->_queryAct, SIGNAL(triggered()), this, SLOT(sFillList())); connect(_data->_printAct, SIGNAL(triggered()), this, SLOT(sPrint())); connect(_data->_previewAct, SIGNAL(triggered()), this, SLOT(sPreview())); connect(_data->_searchAct, SIGNAL(triggered()), this, SLOT(sFillList())); connect(this, SIGNAL(fillList()), this, SLOT(sFillList())); connect(_data->_list, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*,QTreeWidgetItem*,int))); connect(_data->_autoupdate, SIGNAL(toggled(bool)), this, SLOT(sAutoUpdateToggled())); connect(filterButton, SIGNAL(toggled(bool)), _data->_moreBtn, SLOT(setChecked(bool))); }
ManufacturerDialog::ManufacturerDialog(QWidget* _parent, Qt::WindowFlags _f) : QDialog(_parent, _f) , m_ui(new Ui::ManufacturerDialog) { m_ui->setupUi(this); fillList(); connect(m_ui->addButton, SIGNAL(pressed()), SLOT(addManufacturer())); connect(m_ui->lineEdit, SIGNAL(returnPressed()), SLOT(addManufacturer())); connect(m_ui->listWidget, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(itemClicked(QListWidgetItem*))); }
void run() { fillList(); sortList(); cutList(); //printList(); }
void ProfilesDialog::slotDeleteProfile() { const QString path = m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString(); bool success = false; if (path.contains('/')) { success = QFile::remove(path); fillList(); } if (!success) qDebug()<< "//// Cannot delete profile " << path << ", does not seem to be custom one"; }